Re: Domains and Casting

From: "Rod Taylor" <rbt(at)zort(dot)ca>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Domains and Casting
Date: 2002-06-19 00:58:12
Message-ID: 02b801c2172c$637d9690$fe01a8c0@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Erm... I suppose I didn't really intend to bring up domains at all.
I'm just playing trying to figure out how things work (easiest by
breaking them I think).

I don't understand why the below patch has such an adverse affect on
the system.
Causes:

(p2.pronargs != 3 OR p2.proretset OR p2.proargtypes[2] !=
'int4'::regtype);
! ERROR: Invalid type name 'int4'

or

(p2.oprkind != 'b' OR p2.oprresult != 'bool'::regtype OR
! ERROR: Invalid type name 'bool'

Index: src/backend/parser/gram.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.314
diff -c -r2.314 gram.y
*** src/backend/parser/gram.y 2002/05/12 20:10:04 2.314
--- src/backend/parser/gram.y 2002/06/19 00:54:44
***************
*** 6424,6442 ****
* (We don't want to collapse x::type1::type2 into just x::type2.)
* Otherwise, generate a TypeCast node.
*/
! if (IsA(arg, A_Const) &&
! ((A_Const *) arg)->typename == NULL)
! {
! ((A_Const *) arg)->typename = typename;
! return arg;
! }
! else
! {
TypeCast *n = makeNode(TypeCast);
n->arg = arg;
n->typename = typename;
return (Node *) n;
! }
}

static Node *
--- 6424,6442 ----
* (We don't want to collapse x::type1::type2 into just x::type2.)
* Otherwise, generate a TypeCast node.
*/
! // if (IsA(arg, A_Const) &&
! // ((A_Const *) arg)->typename == NULL)
! // {
! // ((A_Const *) arg)->typename = typename;
! // return arg;
! // }
! // else
! // {
TypeCast *n = makeNode(TypeCast);
n->arg = arg;
n->typename = typename;
return (Node *) n;
! // }
}

static Node *
--
Rod
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Rod Taylor" <rbt(at)zort(dot)ca>
Cc: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Sent: Tuesday, June 18, 2002 10:58 AM
Subject: Re: [HACKERS] Domains and Casting

> "Rod Taylor" <rbt(at)zort(dot)ca> writes:
> > This appears to be due to makeTypeCast() in gram.y which bypasses
> > creating a TypeCast node for simple A_Const.
>
> My immediate reaction is that you've probably put the testing of
> domain constraints in the wrong place. You didn't say exactly
> what your implementation looked like though ...
>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-06-19 01:24:29 Re: [Fwd: [PATCHES] contrib/showguc (was Re: revised sample
Previous Message Josh Berkus 2002-06-19 00:47:08 Re: date_part