Fix up JOIN .. USING with domains

Started by Bruce Momjianabout 23 years ago1 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Fix up JOIN .. USING with domains

------------------------------------------------------------------------

* *From*: *Rod Taylor <rbt@rbt.ca <mailto:rbt%40rbt.ca>>*
* *To*: *PostgreSQL Patches <pgsql-patches@postgresql.org
<mailto:pgsql-patches%40postgresql.org>>*
* *Subject*: *Fix up JOIN .. USING with domains*
* Date: 08 Jun 2003 09:57:57 -0400

------------------------------------------------------------------------

The attached fixes select_common_type() to support the below case:

create table t1( c1 int);
create domain dom_c1 int;
create table t2(c1 dom_c1);
select * from t1 join t2 using( c1 );

I didn't see a need for maintaining the domain as the preferred type. A
simple getBaseType() call on all elements of the list seems to be
enough.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Index: src/backend/parser/parse_coerce.c
===================================================================
RCS file: /home/rbt/work/postgresql/cvs/pgsql-server/src/backend/parser/parse_coerce.c,v
retrieving revision 2.97
diff -c -r2.97 parse_coerce.c
*** src/backend/parser/parse_coerce.c	26 May 2003 00:11:27 -0000	2.97
--- src/backend/parser/parse_coerce.c	8 Jun 2003 13:54:06 -0000
***************
*** 599,609 ****
  	List	   *l;

Assert(typeids != NIL);
! ptype = lfirsto(typeids);
pcategory = TypeCategory(ptype);
foreach(l, lnext(typeids))
{
! Oid ntype = lfirsto(l);

  		/* move on to next one if no new information... */
  		if ((ntype != InvalidOid) && (ntype != UNKNOWNOID) && (ntype != ptype))
--- 599,609 ----
  	List	   *l;

Assert(typeids != NIL);
! ptype = getBaseType(lfirsto(typeids));
pcategory = TypeCategory(ptype);
foreach(l, lnext(typeids))
{
! Oid ntype = getBaseType(lfirsto(l));

/* move on to next one if no new information... */
if ((ntype != InvalidOid) && (ntype != UNKNOWNOID) && (ntype != ptype))

*Attachment: signature.asc <pgp00615.pgp>*
/Description:/ This is a digitally signed message part

------------------------------------------------------------------------

* Prev by Date: *Re: [BUGS] Detecting proper bison version before
make <msg00101.php>*
* Next by Date: *Re: [BUGS] Detecting proper bison version before
make <msg00105.php>*
* Previous by thread: *Re: pg_dump with conbin <msg00091.php>*
* Next by thread: *[GENERAL] use of Ececute commande with PSQL
<msg00124.php>*
* Index(es):
o *Date* <mail2.php#00100>
o *Thread* <threads.php#00100>

* Home <http://www.postgresql.org/mhonarc/&gt; | Main Index <mail2.php> |
Thread Index <threads.php> *

Hub.Org Networking Services <http://www.hub.org&gt; Area902 Commercial
Directory <http://www.area902.com&gt;

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073