Re: sequence in schema -- broken default

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Lee Harr <missive(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: sequence in schema -- broken default
Date: 2004-01-24 12:27:03
Message-ID: Pine.LNX.4.21.0401241224470.24965-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 23 Jan 2004, Joshua D. Drake wrote:

>
> > 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.
>
>
> I am not sure I exactly understand the above paragraph, but from yourexample
> you are trying to insert into public.foo which does not exist. The value
> would be
> one.foo .
>
> insert into one.foo values();

I've a feeling that's what was meant in the original posting and that having
done that the nextval on the default sequence fails because the sequence is
not in the search_path.

I seem to remember something like turning up sometime last year for me. I
don't have a 7.4 or HEAD install to check against at the moment.

--
Nigel J. Andrews

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lee Harr 2004-01-24 13:29:59 Re: force drop of database others are accessing
Previous Message Kris Jurka 2004-01-24 07:52:05 Re: force drop of database others are accessing