Re: Truncate if exists
От | Josh Berkus |
---|---|
Тема | Re: Truncate if exists |
Дата | |
Msg-id | 5078924D.9020106@agliodbs.com обсуждение исходный текст |
Ответ на | Re: Truncate if exists (Dimitri Fontaine <dimitri@2ndQuadrant.fr>) |
Список | pgsql-hackers |
>> where CONDITION has several possible forms: >> i) {IF|UNLESS} ( SQL expression returning T/F ) >> ii) {IF|UNLESS} {EXISTS|NOT EXISTS} >> {TABLE|SCHEMA|COLUMN|FUNCTION|...} object_name > > Now we're talking about T-SQL? Sorry, I suppose you didn't mean to lead > us that way, but I couldn't resist comparing. Soon enough you want a > full programming language there. Well, embedding such a thing into plpgsql wouldn't be a bad thing. It's a lot less hard on the DevOps person to request that they write a DO statement if the DO statement is one line: DO $$ BEGIN TRUNCATE TABLE foo IF EXISTS foo; END;$$; Come to think of it, I've *often* wished for the perl-ish "do x if y" syntax for plpgsql, and not just for DDL. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com
В списке pgsql-hackers по дате отправления: