I'd like to implement SQL99/200x ARRAY support (well, at least the basics). Does anyone have objections to the following grammar/semantics?

===========================================================
Per SQL200x - examples
===========================================================
create table foo(f1 integer ARRAY[3]);
  result same as create table foo(f1 integer[3]); the 3
  really does nothing (this deviates from spec but is
  same as current implementation)
create table foo(f1 integer ARRAY);
  result same as create table foo(f1 integer[]);
select ARRAY[1,2,3];
  result '{1,2,3}'
select ARRAY[(select oid from pg_class order by relname)];
  result is array of all the oid's in pg_class in relname order
select ARRAY[1,2] || 3
  result '{1,2,3}'
select ARRAY[1,2] || ARRAY[3,4]
  result '{1,2,3,4}'

===========================================================
Proposed PostgreSQL extensions
===========================================================
select ARRAY[[1,2,3], [4,5,6]];
  result '{{1,2,3},{4,5,6}}'
select ARRAY[[1,2],[3,4]] || 5
  result '{{1},{3},{5}}'
select ARRAY[[1,2],[3,4]] || [5,6]
  result '{{1,2},{3,4},{5,6}}'
use UNION's algorithm for deriving the element type when not specified

Comments, suggestions, objections?

Thanks,

Joe


---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to