Re: sequence in schema -- broken default - Mailing list pgsql-general

From Nigel J. Andrews
Subject Re: sequence in schema -- broken default
Date
Msg-id Pine.LNX.4.21.0401241224470.24965-100000@ponder.fairway2k.co.uk
Whole thread Raw
In response to Re: sequence in schema -- broken default  ("Joshua D. Drake" <jd@commandprompt.com>)
List 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


pgsql-general by date:

Previous
From: Kris Jurka
Date:
Subject: Re: force drop of database others are accessing
Next
From: "Lee Harr"
Date:
Subject: Re: force drop of database others are accessing