Re: Fast AT ADD COLUMN with DEFAULTs - Mailing list pgsql-hackers
From | Serge Rielau |
---|---|
Subject | Re: Fast AT ADD COLUMN with DEFAULTs |
Date | |
Msg-id | 718461d8-eb1d-4b83-b364-f72900224221@rielau.com Whole thread Raw |
In response to | Re: Fast AT ADD COLUMN with DEFAULTs (Vitaly Burovoy <vitaly.burovoy@gmail.com>) |
Responses |
Re: Fast AT ADD COLUMN with DEFAULTs
|
List | pgsql-hackers |
<img class="cloudmagic-smart-beacon" height="0" src="https://tr.cloudmagic.com/h/v6/emailtag/tag/1475710688/647b813270dffd4c4b2631f3c9eb3f46/9cf3801d03770ada01bb39dc8f52321d/d3d73fe96985e5e4f5ec045c1bb0ba95/9efab2399c7c560b34de477b9aa0a465/ufo.gif" style="border:0;width:0; height:0; overflow:hidden;" width="0" /><div dir="auto"><span><br /></span><br /><div class="cm_footer"id="cm_footer"><div id="cm_sent_from">via <a href="https://cloudmagic.com/k/d/mailapp?ct=dx&cv=9.0.74&pv=10.11.6&source=email_footer_2">Newton Mail</a></div></div><span><br/></span><div id="cm_replymail_content_wrap"><div class="">On Wed, Oct 5, 2016 at 4:19 PM, VitalyBurovoy <vitaly.burovoy@gmail.com> wrote:<br /><div id="cm_replymail_content_1475709656" style="overflow: visible;"><blockquotestyle="margin:0;border-left: #D6D6D6 1px solid;padding-left: 10px;">On 10/5/16, Tom Lane <tgl@sss.pgh.pa.us>wrote:<br />> I wrote:<br />>> Need a better name for the concept, since evidently thisname isn't<br />>> conveying the idea.<br />><br />> Maybe "creation default" would work better? Point beingit's the<br />> default value at the time of column creation.<br />Hmm... Personaly for me the original topic nameis good enough.</blockquote><div id="ID_1475709663350">I think at issue is with the term “exist default” rather thanthe feature/topic name (?)</div><div id="ID_1475709663350"> </div><blockquote class="" style="margin: 0px; border-left-color:rgb(214, 214, 214); border-left-width: 1px; border-left-style: solid; padding-left: 10px;">But what I discoverfor myself is that we have pg_attrdef separately<br />from the pg_attribute. Why?<br />Is it time to join them? Fornot presented defaults it would be only<br />one bit per row(if we avoid "adsrc" as it is recommended), but for a<br />separatetable it is 11 columns with two indexes now...</blockquote><div id="ID_1475709743037">In terms of footprint wemay be able to remove pg_attrdef.</div><div id="ID_1475709743037">I would consider that orthogonal to the proposed featurethough.</div><div id="ID_1475709743037">The internal representation of defaults in the tuple descriptor still needsto be a map of sorts.</div><div id="ID_1475709743037"><br /></div><div id="ID_1475709743037">To comment on PantelisSQL Server Reference:</div><div id="ID_1475709743037">Other vendors such as Oracle and DB2 also support this feature.</div><divid="ID_1475709743037"><br /></div><div id="ID_1475709743037">The listed restriction made me loop back toVitaly’s original serial example:</div><div id="ID_1475709743037">ALTER TABLE t ADD COLUMN c2 serial;</div><div id="ID_1475709743037">andrethink Tom’s struct restriction to constants.</div><div id="ID_1475709743037"><br /></div><divid="ID_1475709743037">In PG the proposed feature would also have to be limited to immutable(?) default expressionsto comply with existing behavior, which matches SQL Servers.</div><div id="ID_1475709743037"><br /></div><divid="ID_1475709743037">My current patch does not restrict that and thusly falsely "fills in" the same value forall rows. </div><div id="ID_1475709743037"><br /></div><div id="ID_1475709743037">Cheers</div><div id="ID_1475709743037">SergeRielau</div><div id="ID_1475709743037">Salesforce.com</div><div id="ID_1475709743037"><br /></div></div></div></div></div>
pgsql-hackers by date: