pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fred Parkinson <FredP@abag.ca.gov>
Cc: pgsql-admin@postgresql.org
Subject: Re: Can't query the sequence table of a serial primary key.
Date: Thu, 23 Feb 2012 14:35:23 -0500
Message-ID: <4387.1330025723@sss.pgh.pa.us> (raw)
In-Reply-To: <4F461C53020000A70001B6BB@gwia1.abag.ca.gov>
References: <4F461C53020000A70001B6BB@gwia1.abag.ca.gov>

"Fred Parkinson" <FredP@abag.ca.gov> writes:
> We have moved some databases from 7.x to 8.4
> Previously I could query the sequencing table of a 'serial primary key' by simply running
> select * from mytable_id_seq;
> where mytable has id as a serial primary key and mytable_id_seq is the postgresql relation which manages the key.

That naming relationship isn't guaranteed, and AFAIR it wasn't
guaranteed in 7.4 either; in case of name collision you'd get something
like mytable_id_seq1 instead.

> When I do \d I see the table and the sequencer under 'List of relations'.
> But when I run select * from mytable_id_seq; postgresql responds with:
> relation 'mytable_id_seq' does not exist.

Maybe the sequence is in a schema that's not in your search_path.

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <4387.1330025723@sss.pgh.pa.us>
Permalink:  ../4387.1330025723@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4387.1330025723@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, FredP@abag.ca.gov
  Subject: Re: Can't query the sequence table of a serial primary key.
  In-Reply-To: <4387.1330025723@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox