I must have a fundamental misunderstanding about using schema.
Before using schema, I usually have a file that has my database
definition, and I can play that file back in to a new database to
create a testing area or to create my production setup.
I think I want to use schema the same way.
My problem is using a sequence for a default value. I know that
if I use a serial instead, all of this will go away, but my design
already uses separate sequences, so I am hoping I will not need
to change it...
This illustrates the problem:
CREATE DATABASE d;
\c d
CREATE SCHEMA one;
SET search_path TO one;
CREATE SEQUENCE foo_seq;
CREATE TABLE foo(
i integer
DEFAULT nextval('foo_seq')
);
SET search_path TO public;
INSERT INTO foo VALUES (DEFAULT);
The problem is that the DEFAULT nextval(... needs to qualify
the sequence with the schema, but I am not sure how to
determine the schema in my definition file.
Any hints?
__________________________________________________ _______________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings