Re: [SQL] DEFAULT Constraint based on table type?

2005-11-29 Thread Oliver Elphick
On Mon, 2005-11-28 at 14:22 -0600, Announce wrote: > Lets say I have the following tables. > > CREATE TABLE animals(id primary key, name varchar, type varchar); > CREATE TABLE dogs (breed varchar)INHERITS (animals); > CREATE TABLE birds (bool hasFeathers) INHERITS (animals); > > Is th

Re: [SQL] DEFAULT Constraint based on table type?

2005-11-29 Thread Oliver Elphick
On Tue, 2005-11-29 at 10:31 +, Oliver Elphick wrote: > SELECT tableoid::regproc, * from animals; regproc should be regclass; sorry. -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A5

Re: [SQL] How to change database owner in PostgreSQL 7.4?

2005-11-29 Thread frank church
Quoting Andreas Kretschmer <[EMAIL PROTECTED]>: > frank church <[EMAIL PROTECTED]> schrieb: > > > Hi guys, > > > > What is the command change database owner in PostgreSQL 7.4? > > ALTER DATABASE foo OWNER TO blob; I tried that and it didn't work. That command appears to be available only in 8.0.

[SQL] Strange bug

2005-11-29 Thread Leif B. Kristensen
I just noticed that I accidentally got a duplicate id. My definitions are here: CREATE TABLE citations ( citation_id INTEGER PRIMARY KEY, source_fk INTEGER REFERENCES sources (source_id) ); CREATE TABLE relation_citations ( relation_fk INTEGER REFERENCES rela

Re: [SQL] Strange bug

2005-11-29 Thread Tom Lane
"Leif B. Kristensen" <[EMAIL PROTECTED]> writes: > I just noticed that I accidentally got a duplicate id. My > definitions are here: > CREATE TABLE citations ( > citation_id INTEGER PRIMARY KEY, > source_fk INTEGER REFERENCES sources (source_id) > ); > CREATE TABLE relat

Re: [SQL] Strange bug

2005-11-29 Thread A. Kretschmer
am 29.11.2005, um 15:31:30 +0100 mailte Leif B. Kristensen folgendes: > CREATE TABLE citations ( > citation_id INTEGER PRIMARY KEY, > source_fk INTEGER REFERENCES sources (source_id) > ); > > CREATE TABLE relation_citations ( > relation_fk INTEGER REFERENCES

Re: [SQL] Strange bug

2005-11-29 Thread Leif B. Kristensen
On Tuesday 29 November 2005 15:37, Tom Lane wrote: >relation_citations doesn't have a primary key. See >http://www.postgresql.org/docs/8.1/static/ddl-inherit.html >particularly the "caveats" section. Uh-oh. That's my first 'gotcha' in PostgreSQL. I added the following constraints: ALTER TABLE r

Re: [SQL] Strange bug

2005-11-29 Thread Leif B. Kristensen
On Tuesday 29 November 2005 15:43, A. Kretschmer wrote: >> I got an error when I transferred the data to my Web database >> running MySQL: > >MySQL is a other RDBMS. You can't expect that all features from >PostgreSQL are working with MySQL. > >> ERROR 1062 at line 19839 in file: 'ss_relation_citat

Re: [SQL] Strange bug

2005-11-29 Thread Leif B. Kristensen
On Tuesday 29 November 2005 15:52, Leif B. Kristensen wrote: >Uh-oh. That's my first 'gotcha' in PostgreSQL. > >I added the following constraints: I probably should drop both the inheritance and the citation_id altogether, and operate with two separate tables: CREATE TABLE relation_citations (

[SQL] 'AS' in 'DELETE/UPDATE'

2005-11-29 Thread engineer
Hi. Maybe I miss something but I can't use 'AS' with 'DELETE' (7.4.3) Example: db=# SELECT * FROM temp1 ; host_id | user_id | raw | uniq -+-+-+-- 2 | 1 | 125 | 85 2 | 2 | 100 | 50 (2 rows) And there is temp2 just like temp1. db=# DELETE FRO

Re: [SQL] 'AS' in 'DELETE/UPDATE'

2005-11-29 Thread Bruce Momjian
TODO has: o Allow an alias to be provided for the target table in UPDATE/DELETE This is not SQL-spec but many DBMSs allow it. so we want to add this capability some day. --- [EMAIL PROTECTED] w

Re: [SQL] 'AS' in 'DELETE/UPDATE'

2005-11-29 Thread Jaime Casanova
> It looks strange, are there any limitations or something else that > make it not possible to use 'AS' in 'DELETE' and 'UPDATE'? Of course > with described workarounds I can eliminate that problems, but I want > to know is it so in 8.x? Or why, if it right behaviour? > > -- > engineer > --- extra

Re: [SQL] Strange bug

2005-11-29 Thread Leif B. Kristensen
On Tuesday 29 November 2005 17:01, Leif B. Kristensen wrote: >Is there an easy and non-disruptive way to do this? For the record, I just did the following: pgslekt=> create table rel_cits ( pgslekt(> relation_fk integer references relations (relation_id), pgslekt(> source_fk integer references so

Re: [SQL] Triggers

2005-11-29 Thread Jan Wieck
On 11/23/2005 3:44 AM, Achilleus Mantzios wrote: O Neil Saunders έγραψε στις Nov 22, 2005 : And change AFER INSERT to BEFORE INSERT 1) it doesnt make any difference since we are updating a different table than the trigger's one In this particular case it doesn't. In general, another BEFOR