Re: sequence in schema -- broken default

From: "Lee Harr" <missive(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: sequence in schema -- broken default
Date: 2004-01-23 20:14:53
Message-ID: BAY2-F172yAeYQsXMqf0001a39e@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>By the way... should the way you wrote it work?
>>
>No. I did not complete the syntax.
>
>
>># INSERT INTO one.foo VALUES ();
>>ERROR: syntax error at or near ")" at character 29
>>
>>Seems like maybe it should work with the default, but I don't know.
>>
>No, the reason the below works is version() is a function where values
>() is not.

Yes. I was just including that in case something had changed in
recent versions. I guess it just seemed strange to me that this
works ...

# create table x (a int, b int);
CREATE TABLE
# insert into x values(5);
INSERT 18518 1

but this does not ...

# insert into x values();
ERROR: syntax error at or near ")" at character 22

>I don't think you are going to have any choice but to hardcode the
>sequence value
>unless you want to bounce in between search paths based on who is
>connecting.

All I really want is some way to ensure that the DEFAULT is hooked
up to the right sequence.

I guess maybe it could be considered a feature that you can code
the nextval as a relative name and have the value pulled from different
sequences depending on your search_path, but I think a more useful
pattern is to always pull from the same sequence.

Of course, I guess that is why there is a serial type ;o)

Thanks for your time.

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2004-01-23 20:15:56 Re: If table A value IS NULL then table B
Previous Message Holger Marzen 2004-01-23 19:44:57 Article in German iX magazine