Re: Cannot add an column of type serial

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: David Sigeti <sigeti(at)lanl(dot)gov>
Cc: pgadmin-support(at)postgresql(dot)org, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cannot add an column of type serial
Date: 2003-12-10 16:13:35
Message-ID: 3FD7462F.40808@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-hackers

David Sigeti wrote:

> At 12:21 PM 12/10/2003 +0100, Andreas Pflug wrote:
>
>> David Sigeti wrote:
>>
>>> I am using pgadminIII 1.0.2 with PostgreSQL 7.4 under W2K SP4 and
>>> Cygwin (current as of 2 or 3 weeks ago). The server is running
>>> locally.
>>>
>>> If I attempt to add an column of type serial or bigserial to a
>>> table, the operation fails with a message telling me that adding an
>>> column with a default value is not implemented. What is really
>>> weird is that one can, in fact, add a column with a default value,
>>> like an int4 with a default value or 0.
>>
pgAdmin breaks this into two steps for you; have a look at the SQL page.

>>> The problem does not arise if the serial (or bigserial) column is
>>> created when the table is created (as a part of CREATE TABLE).
>>
>> serial isn't a true datatype but a keyword that can be used only at
>> creation time. Still, pgAdmin3 should create the commands necessary
>> for this to make life easier; I added this as a TODO item.
>
>
> Adding this functionality would be great but I suggest that the error
> message be changed right away as it is seriously misleading.
>
The error message originates from the backend. I agree that this might
be confusing to newbies, who don't know that serial actually is int4
default nextval('...') (currently pgAdmin3 doesn't either :-)

I'm forwarding this to pgsql-hackers.

Regards,
Andreas

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message llepc 2003-12-11 13:37:11 database link
Previous Message David Sigeti 2003-12-10 15:54:46 Re: Cannot add an column of type serial or

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2003-12-10 16:23:05 Re: pljava revisited
Previous Message Tom Lane 2003-12-10 16:07:55 Re: ERROR: Index pg_toast_8443892_index is not a btree