>> 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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to