Skip site navigation (1) Skip section navigation (2)

Re: Truncate if exists

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Sébastien Lardière <slardiere(at)hi-media(dot)com>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Truncate if exists
Date: 2012-10-12 16:23:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On 10/12/2012 12:03 PM, Sébastien Lardière wrote:
> If we can do something like :
> SELECT pg_if_table_exists('bar' , pg_if_table_exists('foo', 'TRUNCATE
> TABLE foo, bar, foobar')) ;
> or
> SELECT pg_if_tables_exists('TRUNCATE TABLE foo, bar, foobar', 'foo',
> 'bar') ;
> I say yes !

This strikes me as just highly un-SQL-like.

Someone could fairly easily write it for themselves in Plpgsql or C, but 
it doesn't seem to me like something we should be doing.

I tend to agree with Noah's comment upthread:

> But the syntax is a bandage for raw psql input remaining a hostile
> environment for implementing the full range of schema changes.  Switch to
> submitting your SQL from a richer programming environment, and these additions
> to core syntax cease to add much.

I think this goes a fortiori for Heath Robinson-like devices such as this.



In response to


pgsql-hackers by date

Next:From: Pavel StehuleDate: 2012-10-12 16:29:47
Subject: Re: Truncate if exists
Previous:From: Andres FreundDate: 2012-10-12 16:08:19
Subject: Re: velog + vereport?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group