Обсуждение: ALTER SEQUENCE: Missing feature?

Поиск
Список
Период
Сортировка

ALTER SEQUENCE: Missing feature?

От
david@fetter.org (David Fetter)
Дата:
Kind people,

The fine folks in #postgresql brought this up, and it seems like,
well, a bug.  In order to make certain kinds of changes on a SEQUENCE,
you have to issue an ALTER TABLE statement.  Shouldn't alterations
like RENAME TO, OWNER, etc. to a SEQUENCE all (be able to) go through
ALTER SEQUENCE?  What else might this impact?

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100    cell: +1 415 235 3778

Before you try to play the history card, make sure it's in your hand.


Re: ALTER SEQUENCE: Missing feature?

От
Tom Lane
Дата:
david@fetter.org (David Fetter) writes:
> The fine folks in #postgresql brought this up, and it seems like,
> well, a bug.  In order to make certain kinds of changes on a SEQUENCE,
> you have to issue an ALTER TABLE statement.  Shouldn't alterations
> like RENAME TO, OWNER, etc. to a SEQUENCE all (be able to) go through
> ALTER SEQUENCE?  What else might this impact?

Sequences are tables in some very real senses.  I don't see the value in
duplicating code just to allow people to spell TABLE as SEQUENCE in
these commands...
        regards, tom lane


Re: ALTER SEQUENCE: Missing feature?

От
David Fetter
Дата:
On Sun, Feb 01, 2004 at 02:53:18PM -0500, Tom Lane wrote:
> david@fetter.org (David Fetter) writes:
> > The fine folks in #postgresql brought this up, and it seems like,
> > well, a bug.  In order to make certain kinds of changes on a
> > SEQUENCE, you have to issue an ALTER TABLE statement.  Shouldn't
> > alterations like RENAME TO, OWNER, etc. to a SEQUENCE all (be able
> > to) go through ALTER SEQUENCE?  What else might this impact?
> 
> Sequences are tables in some very real senses.  I don't see the
> value in duplicating code just to allow people to spell TABLE as
> SEQUENCE in these commands...

I guess it comes down to a philosophical thing.  Should people need to
know the PostgreSQL internals like the fact that a SEQUENCE is
currently implemented as a TABLE, or should they just be able to do
reasonable things like call ALTER SEQUENCE when they alter a sequence?

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100    cell: +1 415 235 3778


Re: ALTER SEQUENCE: Missing feature?

От
"Joshua D. Drake"
Дата:
<br /><blockquote cite="mid20040201195739.GE19912@fetter.org" type="cite"><blockquote type="cite"><pre
wrap="">Sequencesare tables in some very real senses.  I don't see the
 
value in duplicating code just to allow people to spell TABLE as
SEQUENCE in these commands...   </pre></blockquote><pre wrap="">
I guess it comes down to a philosophical thing.  Should people need to
know the PostgreSQL internals like the fact that a SEQUENCE is
currently implemented as a TABLE, or should they just be able to do
reasonable things like call ALTER SEQUENCE when they alter a sequence?
 </pre></blockquote> I would have to second this. From a user, user space programmer, dba perspective a SEQUENCE is
a<br/> SEQUENCE not a table... thus operations such as ALTER that effect the SEQUENCE should<br /> use ALTER
SEQUENCE.<br/><br /> Sincerely,<br /><br /> Joshua D. Drake<br /><br /><br /><br /><br /><blockquote
cite="mid20040201195739.GE19912@fetter.org"type="cite"><pre wrap="">Cheers,
 
D </pre></blockquote><br /><br /><pre class="moz-signature" cols="72">-- 
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - <a class="moz-txt-link-abbreviated" href="mailto:jd@commandprompt.com">jd@commandprompt.com</a> - <a
class="moz-txt-link-freetext"href="http://www.commandprompt.com">http://www.commandprompt.com</a>
 
PostgreSQL Replicator -- production quality replication for PostgreSQL</pre>

Re: ALTER SEQUENCE: Missing feature?

От
Tom Lane
Дата:
"Joshua D. Drake" <jd@commandprompt.com> writes:
>> I guess it comes down to a philosophical thing.  Should people need to
>> know the PostgreSQL internals like the fact that a SEQUENCE is
>> currently implemented as a TABLE, or should they just be able to do
>> reasonable things like call ALTER SEQUENCE when they alter a sequence?
>> 
> I would have to second this.

Well, (1) we are not going to be able to hide the implementation fact
entirely --- for instance, you can't readily hide that they share the
same namespace, so that you can't have a table and a sequence of the
same name.  People will have to learn this fact about sequences
eventually.  For that matter we advertise it by using "SELECT * FROM
sequence" as a way of inspecting sequence parameters; will you invent
a replacement for that?

(2) If you do want to hide it at the cosmetic level you will have more
work to do than this.  ALTER TABLE also works (in some variants) on
indexes; will you also invent ALTER INDEX?  See also GRANT/REVOKE; will
you change that syntax too?  Will you invent new privilege names for
sequences to hide the overlap with table privilege types?  Will you
forbid the old spellings of all this stuff (thereby breaking existing
pg_dump files)?

It just seems like a much bigger can of worms to open than the payback
would justify.
        regards, tom lane


Re: ALTER SEQUENCE: Missing feature?

От
"Joshua D. Drake"
Дата:
Tom Lane wrote: <blockquote cite="mid2197.1075670658@sss.pgh.pa.us" type="cite"><pre wrap="">"Joshua D. Drake" <a
class="moz-txt-link-rfc2396E"href="mailto:jd@commandprompt.com"><jd@commandprompt.com></a> writes:
</pre><blockquotetype="cite"><blockquote type="cite"><pre wrap="">I guess it comes down to a philosophical thing.
Shouldpeople need to
 
know the PostgreSQL internals like the fact that a SEQUENCE is
currently implemented as a TABLE, or should they just be able to do
reasonable things like call ALTER SEQUENCE when they alter a sequence?
     </pre></blockquote><pre wrap="">I would have to second this.   </pre></blockquote><pre wrap="">
same name.  People will have to learn this fact about sequences
eventually.  For that matter we advertise it by using "SELECT * FROM
sequence" as a way of inspecting sequence parameters; will you invent
a replacement for that?
 </pre></blockquote> No because PostgreSQL uses SELECT for many things, including the execution of functions.<br /><br
/><br/><blockquote cite="mid2197.1075670658@sss.pgh.pa.us" type="cite"><pre wrap="">(2) If you do want to hide it at
thecosmetic level you will have more
 
work to do than this.  ALTER TABLE also works (in some variants) on
indexes; will you also invent ALTER INDEX?</pre></blockquote> No because from a logical (at least mine) perspective,
Indicesare a table only thing. Sequences<br /> are not always used in correlation with a table. <br /><blockquote
cite="mid2197.1075670658@sss.pgh.pa.us"type="cite"><pre wrap="">  See also GRANT/REVOKE; will
 
you change that syntax too?</pre></blockquote><br /> I am not sure how this is even relevant as GRANT / REVOKE can be
appliedto a specific object?<br /><br /><blockquote cite="mid2197.1075670658@sss.pgh.pa.us" type="cite"><pre wrap="">
Willyou invent new privilege names for
 
sequences to hide the overlap with table privilege types?  Will you
forbid the old spellings of all this stuff (thereby breaking existing
pg_dump files)?

It just seems like a much bigger can of worms to open than the payback
would justify. </pre></blockquote> That may be the case but couldn't you just have a generic function within C that
justcalls out the<br /> appropriate parameters per the relation? E.g; it knows that ALTER SEQUENCE is actually<br />
ALTERTABLE minus these six (whatever six they may be) parameters?<br /><br /> Sincerely,<br /><br /> Joshua D. Drake<br
/><br/><br /><br /><blockquote cite="mid2197.1075670658@sss.pgh.pa.us" type="cite"><pre wrap="">        regards, tom
lane</pre></blockquote><br /><br /><pre class="moz-signature" cols="72">-- 
 
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - <a class="moz-txt-link-abbreviated" href="mailto:jd@commandprompt.com">jd@commandprompt.com</a> - <a
class="moz-txt-link-freetext"href="http://www.commandprompt.com">http://www.commandprompt.com</a>
 
PostgreSQL Replicator -- production quality replication for PostgreSQL</pre>