From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org, Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> |
Subject: | Re: [HACKERS] NULL as an argument in plpgsql functions |
Date: | 1999-10-02 18:19:38 |
Message-ID: | 8149.938888378@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> writes:
> this select produces error message:
> test=> select test2(NULL);
> ERROR: typeidTypeRelid: Invalid type - oid = 0
[ where test2 is a plpgsql function ]
Actually this is not a plpgsql issue; with current sources you get the
same error with any function, for example
regression=> select int4fac(NULL);
ERROR: typeidTypeRelid: Invalid type - oid = 0
Digging into this, I find that (a) make_const() in parse_node.c produces
a Const node for the NULL that has consttype = 0; (b) ParseFuncOrColumn
applies ISCOMPLEX() which tries to get the type tuple for the argument
of the function; (c) that fails because the type ID is 0.
I am not sure whether there are two bugs here or only one. It would
probably be better to mark the Const node as having type UNKNOWN instead
of type 0 (but make_const is not the only place that makes null
constants this way! we'd need to find all the others...). But I am not
sure whether ParseFuncOrColumn would then do the right thing in terms of
resolving the type of the function; for that matter I'm not real sure
what the right thing for it to do is.
Thomas, this stuff is mostly your bailiwick; what do you think?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | frankpit | 1999-10-02 18:22:40 | Re: [HACKERS] Doccumentation Patch for Create Function |
Previous Message | Tom Lane | 1999-10-02 17:47:11 | Re: [HACKERS] Regression tests on intel for 6.5.2 |