Re: [HACKERS] Feature request - function-based deferrable uniques.

2010-04-01 Thread Dmitry Fefelov
> Sure -- use CREATE UNIQUE INDEX. > > alvherre=# create function singleton(int) returns int immutable language sql as $$ select 1 $$; > CREATE FUNCTION > alvherre=# create table singleton (a int); > CREATE TABLE > alvherre=# create unique index only_one on singleton (singleton(a)); > CREATE IND

Re: [HACKERS] Feature request - function-based deferrable uniques.

2010-04-01 Thread Tom Lane
Alvaro Herrera writes: > The reason it's not supported in table_constraint, IIUC, is that the > standard doesn't allow it, and that syntax is standards-mandated. The real problem is not so much extending the syntax as that there'd be no way to represent the constraint in information_schema. Excl

Re: [HACKERS] Feature request - function-based deferrable uniques.

2010-04-01 Thread Alvaro Herrera
Dmitry Fefelov wrote: > So, deferrable uniques now can be based on column/columns list only. It will > be very useful if there will be possibility to specify functions in this > list. > Is it possible? Sure -- use CREATE UNIQUE INDEX. alvherre=# create function singleton(int) returns int imm

Re: [HACKERS] Feature request - function-based deferrable uniques.

2010-04-01 Thread Dean Rasheed
On 31 March 2010 06:58, Dmitry Fefelov wrote: > For now Postgres able to create deferrable uniques with following syntax: > > ... > and table_constraint is: > > [ CONSTRAINT constraint_name ] > { UNIQUE ( column_name [, ... ] ) index_parameters | >  PRIMARY KEY ( column_name [, ... ] ) index_param

[HACKERS] Feature request - function-based deferrable uniques.

2010-03-30 Thread Dmitry Fefelov
For now Postgres able to create deferrable uniques with following syntax: ... and table_constraint is: [ CONSTRAINT constraint_name ] { UNIQUE ( column_name [, ... ] ) index_parameters | PRIMARY KEY ( column_name [, ... ] ) index_parameters | CHECK ( expression ) | FOREIGN KEY ( column_name