Re: [HACKERS] I think we need an explicit parsetree node for CAST

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] I think we need an explicit parsetree node for CAST
Дата
Msg-id 200001160539.AAA08651@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] I think we need an explicit parsetree node for CAST  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Actually, I think I never made the additional atttypmod changes because
> > no one had ever reported a problem, and I was confused by that.
> 
> I think that after further discussion, we concluded that it wasn't
> really possible to determine an atttypmod value to attach to the
> result of most expressions.  However, CAST is a special case because
> there *is* a typmod value associated with the Typename node.  The
> thing I want to do is make sure we hold onto that value long enough
> to use it...

I found the area you mentioned and fixed it.  Seems the other areas I
remember being a problem were fixed by me or someone else, maybe you.
I remember makeResdom and makeVar having bogus entries sometimes, but I
see now they are all fixed.

I see your issue, and I don't know the code well enough to comment on
it.

I was able to do:
test=> select 'x' as fred into test ;NOTICE:  Attribute 'fred' has an unknown type        Relation created;
continueSELECTtest=>\d test        Table "test" Attribute |  Type   | Extra -----------+---------+------- fred      |
unknown| 
 
---------------------------------------------------------------------------
test=> select 'x'::varchar as fred into test ;SELECTtest=> \d test          Table "test" Attribute |    Type    | Extra
-----------+------------+-------fred      | varchar(0) | 
 


Seems we should disallow this.  This last one is the one you want to
fix:

---------------------------------------------------------------------------
test=> select 'x'::varchar(20) as fred into test ;SELECTtest=> \d test          Table "test" Attribute |    Type    |
Extra-----------+------------+------- fred      | varchar(0) | 
 

--  Bruce Momjian                        |  http://www.op.net/~candle pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] pg_dump not in very good shape
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] I think we need an explicit parsetree node for CAST