Re: ALTER TABLE ... TO ... to change related names

Поиск
Список
Период
Сортировка
От Dennis Björklund
Тема Re: ALTER TABLE ... TO ... to change related names
Дата
Msg-id Pine.LNX.4.44.0308310019450.4053-100000@zigo.dhs.org
обсуждение исходный текст
Ответ на Re: ALTER TABLE ... TO ... to change related names  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ALTER TABLE ... TO ... to change related names  (Rod Taylor <rbt@rbt.ca>)
Список pgsql-hackers
On Sat, 30 Aug 2003, Tom Lane wrote:

> > I don't understand why the serial columns sequence should be visible as
> > other sequences.
> 
> Backwards compatibility, if nothing else.  Are you prepared to break
> every existing dump file that has
>     CREATE TABLE ser (f1 serial);
>     SELECT pg_catalog.setval('ser_f1_seq', 1, false);

I think breaking backward compability not always bad. If
              
 
a) it the change is sound and good for the long term
b) there is a solution that can be included for a number  of revisions and where you preferably can turn on/off  the
featurewith a variable.
 

The question is if the change is important enough to warrent such a 
breakage. Logically I think it's preferable.

> > create table foo (x serial);
> > select nextval('foo.x');
> 
> This conflicts with the existing provisions for accessing sequences
> using ordinary schema-qualified names ('schema.sequence').

That can of course be fixed by using some other selector then . (dot)  
like nextval('foo#x') or one can keep the dot and resolve it any way. But
I'm not trying to come up with the best syntax here. I was more interested
in the namespace change, to keep serial sequence names out of the "global"
namespace.

The exact syntax is the last problem. The backward compability is a much
bigger issue (with 7.3 since older dumps has no problem).
> The work I would actually like to see getting done in this area is
> the existing TODO item about using Oracle-compatible syntax for nextval
> et al, namely that you can write
>     sequence.nextval
> or
>     schema.sequence.nextval
> rather than nextval('sequence') or nextval('schema.sequence').

It's a separate issue that I also would welcome.

-- 
/Dennis



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Is it a memory leak in PostgreSQL 7.4beta?
Следующее
От: Rod Taylor
Дата:
Сообщение: Re: ALTER TABLE ... TO ... to change related names