Re: Alter column to type serial
От | Thom Brown |
---|---|
Тема | Re: Alter column to type serial |
Дата | |
Msg-id | AANLkTim2ysWsQtB6UO2Gkoveew1SA4fi7fZnBR9wVB1+@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Alter column to type serial (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Alter column to type serial
|
Список | pgsql-hackers |
<div class="gmail_quote">On 4 November 2010 14:04, Tom Lane <span dir="ltr"><<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>></span>wrote:<br /><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Thom Brown<<a href="mailto:thom@linux.com">thom@linux.com</a>> writes:<br /> > Would it be possible (or reasonable) toadd support for changing the type of<br /> > a column to serial or bigserial (yes, yes, I know they're not actual<br/> > types)?<br /><br /></div>We've looked at that in the past and decided there were enough corner<br /> casesthat it wasn't clearly a good idea. In particular, what do you do<br /> with the existing data in the column? Whatdo you do if there's already<br /> a DEFAULT expression for the column, throw it away? In particular, what<br /> ofthe special case that the column is in fact already a serial, so the<br /> default is pointing at an existing sequence?<br/><br /> It is possible to accomplish everything that such a command would do<br /> manually, so the argumentfor having it boils down to wanting it to<br /> be a bit easier. But unless the command can always do the rightthing<br /> automatically, I'm not sure "easy" is a good argument.<br /><br /> There's also the objection that suchan operation would actually have<br /> very little to do with ALTER COLUMN TYPE --- most of the things it would<br />do are not that. The fact that serial was bolted on as a fake type is a<br /> wart that maybe we shouldn't extend in thisparticular fashion.<br /><br /></blockquote></div><br />I suspected this may have been discussed previously, I just failedto find it. And yes, it's purely for simplification, and to auto-clean sequences when tables are dropped. I didn'tthink it would be straightforward, but clearly there are show-stoppers abound.<br /><br />Thanks for the reply though.:)<br clear="all" /><br />-- <br />Thom Brown<br />Twitter: @darkixion<br />IRC (freenode): dark_ixion<br />RegisteredLinux user: #516935<br />
В списке pgsql-hackers по дате отправления: