Re: [HACKERS] Fail to search in array, produced by subquery - is it a bug?

2011-04-27 Thread Dmitry Fefelov
> > well, if you *had* to use any you could rewrite that as: Using ANY I'll reduce number of subqueries, there are also some array overlappings, which works fine with same subquery - i.e. when " && " instead of " = ANY ". There is not full qi\uery in my first message of course. > SELECT * > FRO

[HACKERS] Fail to search in array, produced by subquery - is it a bug?

2011-04-26 Thread Dmitry Fefelov
With Postgres 8.4 query like SELECT * FROM core.tag_links ctl WHERE (ctl.tag_id = ANY ( SELECT array_agg(ct.id) FROM core.tags ct WHERE (LOWER(ct.tag) LIKE LOWER(('search tag')::text || '%') ESCAPE E'\\') )); produces error: ERROR: operator does not e

Re: [HACKERS] Partitioning/inherited tables vs FKs

2010-05-10 Thread Dmitry Fefelov
> The referential integrity triggers contain some extra magic that isn't > easily simulatable in userland, and that is necessary to make the > foreign key constraints airtight. We've discussed this previously but > I don't remember which thread it was or the details of when things > blow up. I th

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

[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

Re: [HACKERS] Partitioning syntax

2010-03-17 Thread Dmitry Fefelov
> > Will 9.1 partitions allow to reference partitioned tables in foreign keys? > > For now, you can do something like this: > > http://people.planetpostgresql.org/dfetter/index.php?/archives/51- Partitioning-Is-Such-Sweet-Sorrow.html > > Cheers, > David. > Already did ;) But workable plain ref

Re: [HACKERS] Partitioning syntax

2010-03-17 Thread Dmitry Fefelov
> Here is a revised partitioning syntax patch. It implements only syntax and > on-disk structure mentioned below: > Table Partitioning#Syntax > http://wiki.postgresql.org/wiki/Table_partitioning#Syntax > Table Partitioning#On-disk structure > http://wiki.postgresql.org/wiki/Tabl

Re: [HACKERS] Partitioning syntax

2010-03-17 Thread Dmitry Fefelov
> Here is a revised partitioning syntax patch. It implements only syntax and > on-disk structure mentioned below: > Table Partitioning#Syntax > http://wiki.postgresql.org/wiki/Table_partitioning#Syntax > Table Partitioning#On-disk structure > http://wiki.postgresql.org/wiki/Tabl

Re: [HACKERS] Dyamic updates of NEW with pl/pgsql

2010-03-11 Thread Dmitry Fefelov
> How can a pl/pgsql trigger change the > values of dynamic fields in NEW record ? > > By "dynamic" I mean that the field name > is a variable in the trigger context. It's not possible in plpgsql, but you can write plperl function, and later use it in plpgsql triggers. Regards, Dmitry -- Sen