Commit d70a944e authored by Bruce Momjian's avatar Bruce Momjian

Bug #1: attribute name when column is type cast:

Given the following table:

test=# \d f
          Table "f"
 Column |  Type   | Modifiers
--------+---------+-----------
 i      | integer |
 test   | text    |

If I do the following:

test=# insert into f values(1,'test');
INSERT 139549 1
test=# select i::int8,test from f;
 ?column? | test
----------+------
        1 | test
(1 row)

It doesn't make much sense that the first column should be called
'?column?'.

The patch results in the output appearing like this:

test=# select i::int8,test from f;
 i | test
---+------
 1 | test
(1 row)

----------

Gavin Sherry
parent be18a49d
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.70 2001/08/09 18:28:18 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.71 2001/09/10 14:53:10 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -462,6 +462,9 @@ FigureColname(Node *expr, Node *resval) ...@@ -462,6 +462,9 @@ FigureColname(Node *expr, Node *resval)
/* Some of these are easiest to do with the untransformed node */ /* Some of these are easiest to do with the untransformed node */
switch (nodeTag(resval)) switch (nodeTag(resval))
{ {
case T_TypeCast:
return( ( ((Ident *) ((TypeCast *) resval)->arg)->name));
case T_Ident: case T_Ident:
return ((Ident *) resval)->name; return ((Ident *) resval)->name;
case T_Attr: case T_Attr:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment