Re: [SQL] unique constraint on views

2008-12-10 Thread Jyoti Seth
I want to put unique constraint on columns of more than one table. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A. Kretschmer Sent: Wednesday, December 10, 2008 6:04 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] unique constraint on views In resp

Re: [SQL] Collapsing (select) row values into single text field.

2008-12-10 Thread Allan Kamau
Thanks Filip for the User Defined Aggregates information I will look into it, and compare its performance with the another probable solution (explained next). I do recall making use of arrays (then array_to_string()) to do this kind of collapsing as a subquery in the select clause of a group by que

[SQL] Is it possible to only allow deletes from a table via referential integrity cascades?

2008-12-10 Thread Christopher Maier
I have two tables joined by a foreign key constraint: CREATE TABLE test_master( id SERIAL PRIMARY KEY, foo TEXT ); CREATE TABLE test_detail( id SERIAL PRIMARY KEY, master BIGINT NOT NULL REFERENCES test_master(id) ON DELETE CASCADE ON UPDATE CASCADE, bar TEXT ); Is ther

Re: [SQL] Best way to "and" from a one-to-many joined table?

2008-12-10 Thread Oliveiros Cristina
*How can I get an AND search (people with Dark Hair AND who are President)?* The two joins didn't work? Or were they too slow ? Best, Oliveiros 2008/12/10 Bryce Nesbitt <[EMAIL PROTECTED]> > > > Milan Oparnica wrote: > > This is how I do it, and it runs fast: > > select p.* > > from test_people

Re: [SQL] Best way to "and" from a one-to-many joined table?

2008-12-10 Thread Bryce Nesbitt
Milan Oparnica wrote: > This is how I do it, and it runs fast: > select p.* > from test_people p inner join test_attributes a on p.people_id = > a.people_id > where a."attribute" = @firstAttr or a."attribute" = @secondAttr But that does an "or" search, not "and", returning Satan in addition to Ob

Re: [SQL] Is there a bug in PostgreSQL ?

2008-12-10 Thread Richard Huxton
Pascal Tufenkji wrote: > > SELECT distinct c.emp_id,c.institution,d.* from sip_carriere c left join > sip_demissionaire d on d.emp_id = c.emp_id where c.emp_id = 342 ; [snip - rows] > > SELECT distinct c.emp_id,c.institution,d.* from sip_carriere c left join > sip_demissionaire d on d.emp_id = c.

Re: [SQL] Is there a bug in PostgreSQL ?

2008-12-10 Thread Tom Lane
"Pascal Tufenkji" <[EMAIL PROTECTED]> writes: > I'm writing a query with a left join to a view, and the server is giving me > a wrong result. What PG version? regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscrip

Re: [SQL] Collapsing (select) row values into single text field.

2008-12-10 Thread Filip RembiaƂkowski
2008/12/10 Allan Kamau <[EMAIL PROTECTED]> > Hi all, > I would like to concatenate the field values of several rows in a table > that meet some similarity criteria based on a the values of some other > field (more like a group by). Then I would also like to also include the > lowest value of ano

[SQL] Is there a bug in PostgreSQL ?

2008-12-10 Thread Pascal Tufenkji
Hello, I'm writing a query with a left join to a view, and the server is giving me a wrong result. SELECT emp_id,institution from sip_carriere where emp_id = 342 and institution = 1; emp_id | institution +- 342 | 1 (1 row) SELECT * from sip_demissi

Re: [SQL] inconsistent automatic casting between psql and function

2008-12-10 Thread Bruce Momjian
Tom Lane wrote: > Richard Huxton <[EMAIL PROTECTED]> writes: > > That's because a quoted literal isn't necessarily a timestamp. Without > > context it could be anything, and in the context of comparing to a date > > the planner probably tries to make it a date. > > I think the real point here is t

[SQL] Collapsing (select) row values into single text field.

2008-12-10 Thread Allan Kamau
Hi all, I would like to concatenate the field values of several rows in a table that meet some similarity criteria based on a the values of some other field (more like a group by). Then I would also like to also include the lowest value of another associated field along. I have a table that

Re: [SQL] unique constraint on views

2008-12-10 Thread A. Kretschmer
In response to Jyoti Seth : > Hi All, > > Is it possible to add unique constraint on updateable views in postgres? Add the constraint to the base-table. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA

[SQL] unique constraint on views

2008-12-10 Thread Jyoti Seth
Hi All, Is it possible to add unique constraint on updateable views in postgres? Thanks, Jyoti Seth -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql