finding my schema (for sequences)

From: "Lee Harr" <missive(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: finding my schema (for sequences)
Date: 2003-12-31 16:37:57
Message-ID: BAY2-F39kVDl4PBUaoB0005b4a1@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am used to creating sequences separately and using them for default
values instead of using the serial type. I am not sure why... but that's the
way I have been doing it. Maybe I don't trust the generated names.
I should probably just get over it, but anyhow...

Let's say I am writing a file for creating a database. Say ...

-- schematest
CREATE SEQUENCE foo_id_seq;
CREATE TABLE foo(
id integer
PRIMARY KEY
DEFAULT nextval('foo_id_seq'),
xx text
);

I want to be able to ...

lee=# drop schema beta cascade;
DROP SCHEMA
lee=# create schema beta;
CREATE SCHEMA
lee=# set search_path to beta;
SET
lee=# \i schematest
CREATE SEQUENCE
CREATE TABLE

The problem is that unlike a comparable serial column, my default value
does not qualify the sequence with the right schema name.

Is there a way to do that, such that my schematest file does not need to
know which schema I am loading the file into?

Or should I just get over my aversion to serial?

_________________________________________________________________
Working moms: Find helpful tips here on managing kids, home, work and
yourself. http://special.msn.com/msnbc/workingmom.armx

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2003-12-31 16:46:30 Re: What does count(*) count?
Previous Message Robert Treat 2003-12-31 16:37:15 Re: Is my MySQL Gaining ?