Re: drop if exists

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: drop if exists
Дата
Msg-id 43511089.9010208@dunslane.net
обсуждение исходный текст
Ответ на Re: drop if exists  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: drop if exists  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: drop if exists  (Darko Prenosil <Darko.Prenosil@inet.hr>)
Список pgsql-hackers

Alvaro Herrera wrote:

>Andrew Dunstan wrote:
>  
>
>>From time to time the suggestion crops up of allowing a DROP IF EXISTS 
>>... syntax. This seems not unreasonable, and I just spent a few minutes 
>>looking at what might be involved.
>>    
>>
>
>What about "CREATE IF NOT EXISTS" (CINE)?  If we support DROP IF EXISTS
>(DIE), is the other one going to be supported too?
>  
>

Maybe. But I am not sure they need to be done together.

>How does this play with schemas?  I assume DIE drops the table in any
>schema in the search path.  What if there's more than one; drop the
>first one?  
>

Yes. Just like now. My idea was that at the point where it currently 
errors out because the object exists, we would instead simply fall 
through and take no action.

>CINE creates the schema in the first schema in the path,
>just like CREATE.
>  
>
>Also, DIE does not need to lock the table afterwards because it won't
>exist, but CINE needs to keep a lock until transaction commit.
>  
>

Right. That's one reason I thought of starting with the DIE case ;-)

cheers

andrew


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: drop if exists
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: drop if exists