From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Schemas not available for pl/pgsql %TYPE.... |
Date: | 2002-09-09 05:31:26 |
Message-ID: | 3D7C322E.6050203@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Tom Lane wrote:
> Sean Chittenden <sean(at)chittenden(dot)org> writes:
>
>>::sigh:: Is it me or does it look like all
>>of pl/pgsql is schema un-aware (ie, all of the declarations). -sc
>
>
> Yeah. The group of routines parse_word, parse_dblword, etc that are
> called by the lexer certainly all need work. There are some
> definitional issues to think about, too --- plpgsql presently relies on
> the number of names to give it some idea of what to look for, and those
> rules are probably all toast now. Please come up with a sketch of what
> you think the behavior should be before you start hacking code.
Attached is a diff -c format proposal to fix this. I've also attached a short
test script. Seems to work OK and passes all regression tests.
Here's a breakdown of how I understand plpgsql's "Special word rules" -- I
think it illustrates the behavior reasonably well. New functions added by this
patch are plpgsql_parse_tripwordtype and plpgsql_parse_dblwordrowtype:
============================================================================
Identifiers (represents) parsing function
----------------------------------------------------------------------------
identifier plpgsql_parse_word
tg_argv
T_LABEL (label)
T_VARIABLE (variable)
T_RECORD (record)
T_ROW (row)
----------------------------------------------------------------------------
identifier.identifier plpgsql_parse_dblword
T_LABEL
T_VARIABLE (label.variable)
T_RECORD (label.record)
T_ROW (label.row)
T_RECORD
T_VARIABLE (record.variable)
T_ROW
T_VARIABLE (row.variable)
----------------------------------------------------------------------------
identifier.identifier.identifier plpgsql_parse_tripword
T_LABEL
T_RECORD
T_VARIABLE (label.record.variable)
T_ROW
T_VARIABLE (label.row.variable)
----------------------------------------------------------------------------
identifier%TYPE plpgsql_parse_wordtype
T_VARIABLE
T_DTYPE (variable%TYPE)
T_DTYPE (typname%TYPE)
----------------------------------------------------------------------------
identifier.identifier%TYPE plpgsql_parse_dblwordtype
T_LABEL
T_VARIABLE
T_DTYPE (label.variable%TYPE)
T_DTYPE (relname.attname%TYPE)
----------------------------------------------------------------------------
<new>
identifier.identifier.identifier%TYPE plpgsql_parse_tripwordtype
T_DTYPE (nspname.relname.attname%TYPE)
----------------------------------------------------------------------------
identifier%ROWTYPE plpgsql_parse_wordrowtype
T_DTYPE (relname%ROWTYPE)
----------------------------------------------------------------------------
<new>
identifier.identifier%ROWTYPE plpgsql_parse_dblwordrowtype
T_DTYPE (nspname.relname%ROWTYPE)
============================================================================
Parameters - parallels the above
----------------------------------------------------------------------------
$# plpgsql_parse_word
$#.identifier plpgsql_parse_dblword
$#.identifier.identifier plpgsql_parse_tripword
$#%TYPE plpgsql_parse_wordtype
$#.identifier%TYPE plpgsql_parse_dblwordtype
$#.identifier.identifier%TYPE plpgsql_parse_tripwordtype
$#%ROWTYPE plpgsql_parse_wordrowtype
$#.identifier%ROWTYPE plpgsql_parse_dblwordrowtype
Comments?
Thanks,
Joe
Attachment | Content-Type | Size |
---|---|---|
plpgsql-nsp-fix.2.patch | text/plain | 7.4 KB |
plpgsql-nsp-testing.sql | text/plain | 1.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | pgsql-bugs | 2002-09-09 08:48:29 | Bug #761: Date format ambiguity while insertion!!!! |
Previous Message | Tatsuo Ishii | 2002-09-09 02:06:03 | Re: crash in apache |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-09-09 06:13:54 | Re: Script to compute random page cost |
Previous Message | Bruce Momjian | 2002-09-09 05:05:49 | Script to compute random page cost |