Re: [PATCHES] Sequence usage patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Rod Taylor" <rbt(at)rbt(dot)ca>, "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Sequence usage patch
Date: 2003-05-28 18:36:45
Message-ID: 5498.1054147005@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> I actually like the NEXT VALUE FOR a lot more. The reason is that the
> Oracle syntax is very much an 'object.property' lookup, which we do nowhere
> else in PostgreSQL.

I beg to differ. We have supported table.function since day one ---
it's in the original Berkeley code. For example:

regression=# \d int8_tbl
Table "public.int8_tbl"
Column | Type | Modifiers
--------+--------+-----------
q1 | bigint |
q2 | bigint |

regression=# create function mysum(int8_tbl) returns int8 as '
regression'# select $1.q1 + $1.q2' language sql;
CREATE FUNCTION
regression=# select *, mysum(t1), t1.mysum from int8_tbl t1;
q1 | q2 | mysum | mysum
------------------+-------------------+------------------+------------------
123 | 456 | 579 | 579
123 | 4567890123456789 | 4567890123456912 | 4567890123456912
4567890123456789 | 123 | 4567890123456912 | 4567890123456912
4567890123456789 | 4567890123456789 | 9135780246913578 | 9135780246913578
4567890123456789 | -4567890123456789 | 0 | 0
(5 rows)

So syntactically, the Oracle notation is in our direct line of
inheritance from Berkeley. The only reason we can't quite get
foo.nextval to work today is that the system wants to put foo
into the query's FROM list, which we don't want for a sequence
reference.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-05-28 18:38:50 Re: SIGSEGV on cvs tip/7.3.2
Previous Message Brian 2003-05-28 17:42:20 Stored Procs / Transaction IDs

Browse pgsql-patches by date

  From Date Subject
Next Message Ben Lamb 2003-05-28 19:26:17 Lonely Patch Seeks Long-Term Commitment to Codebase
Previous Message Darko Prenosil 2003-05-28 17:19:25 Re: loading libraries on Postmaster startup