Re: pg newbie stumped on sequences! - Mailing list pgsql-general

From Doug McNaught
Subject Re: pg newbie stumped on sequences!
Date
Msg-id m31xyt5zka.fsf@varsoon.wireboard.com
Whole thread Raw
In response to pg newbie stumped on sequences!  ("Ben Joyce" <ben.joyce-pgsql@babelfish.co.uk>)
List pgsql-general
"Ben Joyce" <ben.joyce-pgsql@babelfish.co.uk> writes:

> Hi. I'm from a MSSQL/mySQL background and am just poking about in PG.
> I'm using phpPgAdmin 2.3 and PostgreSQL 7.1.3.
>
> INSERT INTO "test" ("ID", "Subject", "Body", "DTS", "Archive") VALUES
> (NEXTVAL('""test_ID_seq""'::text), 'test', 'this is a test', '2003-05-20
> 16:30:42', '0')

This is wrong--the "nextval" call should look like:

NEXTVAL('"test_ID_seq"')

The '::text' cast is optional but shouldn't hurt anything.

Looks like phpPgAdmin is inserting too many quotes.

FYI: the double-quotes-within-single-quotes thing is to tell NEXTVAL
not to fold the sequence name to lower case (which it would do if you
left out the double quotes).  Yes, it's a little odd.  ;)

'

pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: pg newbie stumped on sequences!
Next
From: Mike Benoit
Date:
Subject: Re: disk space usage enlarging despite vacuuming