Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D864FB5DC06 for ; Mon, 29 Aug 2011 13:45:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 51135-01 for ; Mon, 29 Aug 2011 16:45:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5C292B5DC05 for ; Mon, 29 Aug 2011 13:45:39 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p7TGjaNu002615; Mon, 29 Aug 2011 12:45:36 -0400 (EDT) To: Alexey Klyukin cc: Kevin Grittner , Merlin Moncure , pgsql-bugs@postgresql.org Subject: Re: the '::' cast doesn't work in the FROM clause In-reply-to: References: <4E5B449602000025000407D9@gw.wicourts.gov> <4E5B552502000025000407EB@gw.wicourts.gov> <21023.1314629259@sss.pgh.pa.us> Comments: In-reply-to Alexey Klyukin message dated "Mon, 29 Aug 2011 18:31:48 +0300" Date: Mon, 29 Aug 2011 12:45:36 -0400 Message-ID: <2614.1314636336@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201108/178 X-Sequence-Number: 30990 Alexey Klyukin writes: > On Aug 29, 2011, at 5:47 PM, Tom Lane wrote: >> There is a dump/reload bug though :-( ... if you were to do >> >> create view vv as select val from CAST(random() as integer) as val; >> >> you will find that the system prints it out with the :: syntax, >> which won't work. > Would it be acceptable/sufficient to output CAST(...) instead of '::' for all casts in pg_dump to fix this problem, assuming that CAST can be used anywhere where '::' is accepted? I'm not really excited about that; CAST is more verbose and not particularly more readable (at least IMO). What I was wondering about was altering the internal representation to remember which format had been used, and reverse-listing in that same format. That would both fix this issue, and please users who have a stylistic preference for one or the other format. regards, tom lane