sequence in schema -- broken default
| От | Lee Harr |
|---|---|
| Тема | sequence in schema -- broken default |
| Дата | |
| Msg-id | BAY2-F51Oqbdv3Hhl65000185f7@hotmail.com обсуждение исходный текст |
| Ответы |
Re: sequence in schema -- broken default
|
| Список | pgsql-general |
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
В списке pgsql-general по дате отправления: