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

From Lee Harr
Subject Re: sequence in schema -- broken default
Date
Msg-id BAY2-F172yAeYQsXMqf0001a39e@hotmail.com
Whole thread Raw
In response to sequence in schema -- broken default  ("Lee Harr" <missive@hotmail.com>)
Responses Re: sequence in schema -- broken default
List 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


pgsql-general by date:

Previous
From: Holger Marzen
Date:
Subject: Article in German iX magazine
Next
From: Martín Marqués
Date:
Subject: Re: If table A value IS NULL then table B