Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
От | Tom Dunstan |
---|---|
Тема | Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements |
Дата | |
Msg-id | CAPPfruwU=szxfegAmRmfjDQ4rJ-iaQSEaOqmmS4p9VpKtDuULg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements (Peter Eisentraut <peter_e@gmx.net>) |
Список | pgsql-hackers |
<div dir="ltr">On 13 June 2013 04:30, Peter Eisentraut <span dir="ltr"><<a href="mailto:peter_e@gmx.net" target="_blank">peter_e@gmx.net</a>></span>wrote:<br /><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote"style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><span style="color:rgb(34,34,34)">I'mwondering where "IF NOT EXISTS" and "OR REPLACE" will meet.</span><br /></div></blockquote></div><br/></div><div class="gmail_extra">CREATE OR REPLACE (or ALTER / UPDATE ?) would definitely beuseful for enums, where it would be nice if we could teach an ORM to generate DDL based on the current values of the enumin code, and know that after the operation had completed, the database enum type matched the code enum type. I don'tthink a sequence of ALTER TYPE ADD VALUE IF NOT EXISTS quite does the trick, as it doesn't guarantee that the db enumis in the same order as the code enum, which may or may not be important. I'd expect a CREATE OR ALTER for enums to raisean error if any of the elements were out of order.</div><div class="gmail_extra"><br /></div><div class="gmail_extra">Currentlyto get to a known state for enums you have to write manual migration scripts, and while thattends to be how I roll anyway, often when starting projects in rails / grails / hibernate etc people rely on db schemasgenerated by the framework as it lets them prototype with less mucking around. It would be nice for those frameworksto be able to generate enum types in a known state.</div><div class="gmail_extra"><br /></div><div class="gmail_extra">Cheers</div><divclass="gmail_extra"><br /></div><div class="gmail_extra">Tom</div></div>
В списке pgsql-hackers по дате отправления: