pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Jeff Wu <jwu@atlassian.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5974: UNION construct type cast gives poor error message
Date: Wed, 13 Apr 2011 16:39:16 -0400
Message-ID: <11920.1302727156@sss.pgh.pa.us> (raw)
In-Reply-To: <4DA5B8A4020000250003C7A9@gw.wicourts.gov>
References: <201104122018.p3CKIlWR042915@wwwmaster.postgresql.org>
	<201104122018.p3CKIlWR042915@wwwmaster.postgresql.org>
	<9799.1302719551@sss.pgh.pa.us>
	<4DA5B8A4020000250003C7A9@gw.wicourts.gov>

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> From my perspective the "right" answer is to be able to resolve two
> unknown types to unknown rather than text in a few places where we
> are currently compelled to assign a concrete type.

Well, it's not so easy as that.  Consider

	select '1' union select '1 ';

How many rows does that produce?  You cannot answer without imputing a
data type to the columns.  "text" will give a different answer than
"integer" or "bpchar".

It's possible that we could make UNION ALL act differently from all
other set-operations, and refrain from resolving a type for the single
case of UNION ALL; but I can't say that I care for that idea, or see any
support for it in the standard.  AFAICS the standard says that output
data types are to be resolved in the same way for all set operations.

			regards, tom lane



view thread (20+ messages)  latest in thread

Message-ID: <11920.1302727156@sss.pgh.pa.us>
Permalink:  ../11920.1302727156@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11920.1302727156@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov, jwu@atlassian.com
  Subject: Re: BUG #5974: UNION construct type cast gives poor error message
  In-Reply-To: <11920.1302727156@sss.pgh.pa.us>
  References: <201104122018.p3CKIlWR042915@wwwmaster.postgresql.org> <9799.1302719551@sss.pgh.pa.us> <4DA5B8A4020000250003C7A9@gw.wicourts.gov> <11920.1302727156@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox