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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] I think we need an explicit parsetree node for CAST
Date: 2000-01-16 05:39:53
Message-ID: 200001160539.AAA08651@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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; continue
SELECT
test=> \d test
Table "test"
Attribute | Type | Extra
-----------+---------+-------
fred | unknown |

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

test=> select 'x'::varchar as fred into test ;
SELECT
test=> \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 ;
SELECT
test=> \d test
Table "test"
Attribute | Type | Extra
-----------+------------+-------
fred | varchar(0) |

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-01-16 05:40:21 Re: [HACKERS] INDEX_MAX_KEYS and pg_dump
Previous Message Bruce Momjian 2000-01-16 05:36:21 Re: [HACKERS] pg_dump not in very good shape