Re: [SQL] Updating cidr column with network operator

2005-09-26 Thread Axel Rau
Am 26.09.2005 um 02:05 schrieb Michael Fuhr: On Fri, Sep 23, 2005 at 09:19:25PM +0200, Axel Rau wrote: Am 23.09.2005 um 19:32 schrieb Michael Fuhr: On Fri, Sep 23, 2005 at 06:31:17PM +0200, Axel Rau wrote: Networks change during time, being diveded or aggregated or you just enter wrong data

Re: [SQL] Possible to delete record from all tables at the same time?

2005-09-26 Thread Chris Browne
[EMAIL PROTECTED] writes: Is it possible to delete a record from all tables in the database at the same time, without having to execute a separate DELETE statement for each table? I have a situation where I need to delete user records from our system. The user account information is spread

[SQL] add column if doesn't exist

2005-09-26 Thread Brandon Metcalf
Is there a way to check for the existence of a column in a table other than, say, doing a SELECT on that column name and checking the output? I'm basically looking to do an ALTER TABLE foo ADD COLUMN bar if bar doesn't exist. Thanks. -- Brandon ---(end of

Re: [SQL] Updating cidr column with network operator

2005-09-26 Thread Michael Fuhr
On Mon, Sep 26, 2005 at 12:34:59PM +0200, Axel Rau wrote: Am 26.09.2005 um 02:05 schrieb Michael Fuhr: On Fri, Sep 23, 2005 at 09:19:25PM +0200, Axel Rau wrote: I'm sure this would be the cleanest solution but remember networks change. Yes, which is why it's a good idea to

Re: [SQL] add column if doesn't exist

2005-09-26 Thread Peter Eisentraut
Brandon Metcalf wrote: Is there a way to check for the existence of a column in a table other than, say, doing a SELECT on that column name and checking the output? SELECT * FROM information_schema.columns; Customize to taste. -- Peter Eisentraut http://developer.postgresql.org/~petere/

[SQL] how to do 'deep queries'?

2005-09-26 Thread jeff sacksteder
Is there supported syntax to do 'deep' queries? That is where A relates to B relates to C, returning fields from each table? This doesn't seem to work. Is there a google-able term for this sort of query? select foo.aaa, bar.bbb, baz.ccc from foo,bar,baz where foo.bar_id = bar.id and

[SQL] Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT

2005-09-26 Thread Ferindo Middleton Jr
Is there some reason why the SERIAL data type doesn't automatically have a UNIQUE CONSTRAINT. It seems that the main reason for using it is so that the value for this field keeps changing automatically and is never null so any one record can be identified using it- So why not imply that it is

Re: [SQL] how to do 'deep queries'?

2005-09-26 Thread Stewart Ben (RBAU/EQS4) *
Is there supported syntax to do 'deep' queries? That is where A relates to B relates to C, returning fields from each table? This doesn't seem to work. Is there a google-able term for this sort of query? select foo.aaa, bar.bbb, baz.ccc from foo,bar,baz where

Re: [SQL] how to do 'deep queries'?

2005-09-26 Thread Anthony Molinaro
that query is 100% correct. its just an equijoin (a type of inner join) between 3 tables. the syntax you show is how queries should be written and is more representative of what a joins between relations really are: Cartesian products with filters applied the ansi syntax, the

Re: [SQL] Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT

2005-09-26 Thread Tom Lane
Ferindo Middleton Jr [EMAIL PROTECTED] writes: Is there some reason why the SERIAL data type doesn't automatically have a UNIQUE CONSTRAINT. It used to, and then we decoupled it. I don't think I have no use for one without the other translates to an argument that no one has a use for it ...

Re: [SQL] Why doesn't the SERIAL data type automatically have a UNIQUE

2005-09-26 Thread Ferindo Middleton Jr
You're right, Tom. I'm sure someone has a use for a serial field that isn't unique. I just assumed that it was. I guess I didn't read the documentation closely enough. At any rate, I had a table using a serial field that I had to restore to a previous date when I noticed that I forgot to set

Re: [SQL] how to do 'deep queries'?

2005-09-26 Thread jeff sacksteder
Nevermind. It's late here and I'm not thinking clearly. Problem solved.