Re: sequence in schema -- broken default

Поиск
Список
Период
Сортировка
От Lee Harr
Тема Re: sequence in schema -- broken default
Дата
Msg-id BAY2-F172yAeYQsXMqf0001a39e@hotmail.com
обсуждение исходный текст
Ответ на sequence in schema -- broken default  ("Lee Harr" <missive@hotmail.com>)
Ответы Re: sequence in schema -- broken default  ("Joshua D. Drake" <jd@commandprompt.com>)
Список 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 по дате отправления:

Предыдущее
От: Holger Marzen
Дата:
Сообщение: Article in German iX magazine
Следующее
От: Martín Marqués
Дата:
Сообщение: Re: If table A value IS NULL then table B