Re: [HACKERS] Arrays broken on temp tables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Arrays broken on temp tables
Date
Msg-id 2954.941924013@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Arrays broken on temp tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Arrays broken on temp tables  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
> I'm betting that something in the array code is somehow bypassing the
> normal table lookup mechanism, and is managing to see the underlying
> temp-table name that should be hidden from it.  Will look further...

Yup, here it is, in parse_target.c:
   /*    * If there are subscripts on the target column, prepare an    * array assignment expression.  This will
generatean array value    * that the source value has been inserted into, which can then    * be placed in the new
tupleconstructed by INSERT or UPDATE.    * Note that transformArraySubscripts takes care of type coercion.    */   if
(indirection)  {       Attr       *att = makeNode(Attr);       Node       *arrayBase;       ArrayRef   *aref;
 
       att->relname = pstrdup(RelationGetRelationName(rd)->data);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Next question is what to do about it --- the original table name
doesn't seem to be conveniently available in this routine.  A quick
search for other uses of RelationGetRelationName shows other places
that may have related bugs.  Possibly, temprel.c needs to provide
a reverse-lookup routine that will give back the user name of a table
that might be a temp table?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Charles Tassell
Date:
Subject: Re: [HACKERS] Re: [GENERAL] indexed regex select optimisation missing?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Arrays broken on temp tables