Re: Generating TRUNCATE orders - Mailing list pgsql-general

From Richard Huxton
Subject Re: Generating TRUNCATE orders
Date
Msg-id 4703CD33.2010907@archonet.com
Whole thread Raw
In response to Generating TRUNCATE orders  (Laurent ROCHE <laurent_roche@yahoo.com>)
List pgsql-general
Laurent ROCHE wrote:
>
> So I wrote:
> SELECT 'TRUNCATE TABLE '
> UNION
...
> ORDER BY relname
>
> And this fails with the following message:
> ERROR: column "relname" does not exist

> But I don't understand why this does not work: the 2 SELECTs produce a single char column so from what I understand
thatshould work ! ? ! 
> If some body can explain I will be grateful.

The "ORDER BY" is attached to the "UNION" not the second subquery.
Catches everyone out from time to time.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Laurent ROCHE
Date:
Subject: Generating TRUNCATE orders
Next
From: "Scott Marlowe"
Date:
Subject: Re: Generating TRUNCATE orders