[SQL] Mechanics of Update:Cascade

2004-01-31 Thread beyaRecords - The home Urban music
Hi, could someone please explain to me the mechanics of an UpDate:Cascade? Delete:Cascade I fully understand but not Update. I have 2 tables A and B. On B I have created a foreign key on user_id in both B and A for Update and Delete cascade. If I delete from A it deletes all from B. If I update

Re: [SQL] [NOVICE] 'select nextval('seq_name');' in a function ?

2004-01-31 Thread Stephan Szabo
On Sat, 24 Jan 2004, Pragati Kenkare wrote: > I am new to postgresql. Using PostgreSQL 7.3.2, I did the following. > > testdb#CREATE SEQUENCE principal_id increment 1 start 1000 cache 5; > > testdb#CREATE TABLE principal (principal_id int not null, name text, constraint > pk_principal primary key

Re: [SQL] Mechanics of Update:Cascade

2004-01-31 Thread Stephan Szabo
On Sat, 31 Jan 2004, beyaRecords - The home Urban music wrote: > Hi, > could someone please explain to me the mechanics of an UpDate:Cascade? > Delete:Cascade I fully understand but not Update. I have 2 tables A and > B. On B I have created a foreign key on user_id in both B and A for > Update and

Re: [SQL] Mechanics of Update:Cascade

2004-01-31 Thread Richard Huxton
On Saturday 31 January 2004 10:50, beyaRecords - The home Urban music wrote: > Hi, > could someone please explain to me the mechanics of an UpDate:Cascade? > Delete:Cascade I fully understand but not Update. I have 2 tables A and > B. On B I have created a foreign key on user_id in both B and A for

[SQL] 'select nextval('seq_name');' in a function ?

2004-01-31 Thread Pragati Kenkare
Hi, I am new to postgresql. Using PostgreSQL 7.3.2, I did the following. testdb#CREATE SEQUENCE principal_id increment 1 start 1000 cache 5; testdb#CREATE TABLE principal (principal_id int not null, name text, constraint pk_principal primary key(principal_id)); testdb#CREATE FUNCTION getnext_p

[SQL] Sometimes referential integrity seems not to work

2004-01-31 Thread Enio Schutt Junior
In a database I am working, I sometimes have to delete all the records in some tables. According to the referential integrity defined in the creation of the tables, postmaster should not delete the records, but it does. I have used the following commands: "delete from table_1" and "truncate table_

[SQL] An order by question

2004-01-31 Thread David Arnold
All, I need a little help on a sorting problem. Imagine a table, call it records, that has fields: lastName firstName term I want to sort the records by last name, then first name, and finally by term. This almost does what I want: select * from records order by lastName, firstName, term; Howe

[SQL] Mechanics of UpDate:Cascade

2004-01-31 Thread beyaNet Consultancy
Hi, could someone please explain to me the mechanics of an UpDate:Cascade? Delete:Cascade I fully understand but not Update. I have 2 tables A and B. On B I have created a foreign key on user_id in both B and A for Update and Delete cascade. If I delete from A it deletes all from B. If I update

Re: [SQL] Sometimes referential integrity seems not to work

2004-01-31 Thread Stephan Szabo
On Mon, 26 Jan 2004, Enio Schutt Junior wrote: > In a database I am working, I sometimes have to delete all the records in > some tables. According to the referential integrity defined in the creation > of the tables, postmaster should not delete the records, but it does. I have > used the follow

Re: [SQL] Sometimes referential integrity seems not to work

2004-01-31 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Mon, 26 Jan 2004, Enio Schutt Junior wrote: >> In a database I am working, I sometimes have to delete all the records in >> some tables. According to the referential integrity defined in the creation >> of the tables, postmaster should not delete the r

Re: [SQL] Sometimes referential integrity seems not to work

2004-01-31 Thread Stephan Szabo
On Sat, 31 Jan 2004, Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > On Mon, 26 Jan 2004, Enio Schutt Junior wrote: > >> In a database I am working, I sometimes have to delete all the records in > >> some tables. According to the referential integrity defined in the creation > >>