syntax for drop if exists

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема syntax for drop if exists
Дата
Msg-id 43777FFA.3010803@dunslane.net
обсуждение исходный текст
Ответы Re: syntax for drop if exists  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I was just looking briefly at doing "drop if exists" as we discussed 
recently.

The MySQL syntax is actually "drop table if exists foo ...". 
Implementing this unfortunately generates a shift/reduce conflict, 
unless I put IF in the func_name_keyword list, which strikes me as a bad 
idea.

Alternatively,  we could use the syntax "drop if exists table foo ..." 
which seems more natural to me, and generates no conflict.

Or we could live with the conflict, which I think would be harmless 
unless you wanted to delete a table called "if", in which case you might 
need to say "drop table if exists if" ;-)

I'm inclined to live with it, annoying as it is. I looked around to see 
what other DBs do - but AFAICS most don't support this.

Thoughts?

cheers

andrew




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: MERGE vs REPLACE
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: MERGE vs REPLACE