Search Postgresql Archives

Composite type, DEFAULT, NOT NULL, REFERENCES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Is a way to define DEFAULT, NOT NULL and REFERENCES for members of composite type?

For example:

-- type
CREATE TYPE bibl.bibliography AS 
(
	edition TEXT,
	publisher_id BIGINT			
);

-- table def
create table bibl.monograph
(
	id BIGSERIAL PRIMARY KEY NOT NULL,
	bibl bibl.bibliography		
);

-- how to do that, assuming that:
--    we want edition NOT NULL, DEFAULT with value "first"
--    we want publisher_id reffering to bibl.publisher(id) 

This does not work for me:

ALTER TABLE bibl.monograph ALTER COLUMN (bibl).is_bibliography SET NOT NULL;
ALTER TABLE bibl.monograph ALTER COLUMN (bibl).is_bibliography SET DEFAULT false;

Thanks in advance,
Best regards


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux