From: | Marko Pahić <mpahic(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | A question about inheritance and sequence |
Date: | 2009-06-24 11:43:20 |
Message-ID: | 4ae2a0950906240443t20f30de1hd2a78ac51715a9d9@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I have two databases, and I want the same structure, and if I change the
structure of one database it changes the structure of the other. In
documentation I saw that the syntax goes something like this: CREATE TABLE
"User" () INHERITS database2."User"; But it's not working like this, and I
couldn't find the example. Can you please write the correct example?
The other problem I have if with sequence. I have this table structure:
CREATE TABLE "Notes" (
userkey character(40) NOT NULL,
noteid SERIAL NOT NULL,
note text,
PRIMARY KEY (userkey, noteid),
FOREIGN KEY (userkey) REFERENCES "User"(userkey) ON UPDATE CASCADE ON
DELETE CASCADE
);
How can I make the noteid go from 1 to max for each user? Because if I add a
row it goes +1 for all users? How would I do that the note id would go +1
for each userkey. Do I have to make nested queries and where would I do it?
Thank you for help.
Regards,
Marko Pahić
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2009-06-24 12:34:23 | Re: Inserting Values into Interval |
Previous Message | Albe Laurenz | 2009-06-24 08:55:11 | Re: [BUGS] Integrity check |