Fix up JOIN .. USING with domains

Поиск
Список
Период
Сортировка
Искать

Fix up JOIN .. USING with domains

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
    Fix up JOIN .. USING with domains

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

    * *From*: *Rod Taylor >*
    * *To*: *PostgreSQL Patches >*
    * *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 

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 *
/Description:/ This is a digitally signed message part

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

    * Prev by Date: *Re: [BUGS] Detecting proper bison version before
      make *
    * Next by Date: *Re: [BUGS] Detecting proper bison version before
      make *
    * Previous by thread: *Re: pg_dump with conbin *
    * Next by thread: *[GENERAL] use of Ececute commande with PSQL
      *
    * Index(es):
          o *Date* 
          o *Thread* 

* Home  | Main Index  |
Thread Index  *

Hub.Org Networking Services  Area902 Commercial
Directory 


-- 
  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
FAQ