array support patch phase 1 patch
От | Joe Conway |
---|---|
Тема | array support patch phase 1 patch |
Дата | |
Msg-id | 3E7FECF0.7060904@joeconway.com обсуждение исходный текст |
Ответы |
Re: array support patch phase 1 patch
|
Список | pgsql-patches |
This patch is starting to get large enough that it is a challenge to keep in sync with cvs, and it is reasonably complete as a package, so I was hoping it could be reviewed and committed as "array support phase 1". The most notable missing item is documentation, but if possible I'd like to defer that until a few more items are complete (see "Yet-to-come" below). If a more complete package (e.g. want to wait for items 1-5 of "Yet-to-come") is preferred, please let me know and I'll keep plugging along. Note that the gram.y changes are a bit ugly, but I struggled with getting anything less ugly to work. As is, it passes all regression tests (make installcheck), and covers the following: ---------------------------------------------------------------------- 1. Support for polymorphic functions, accepting and returning ANYARRAY and ANYELEMENT datatypes that are "tied" to each other and resolved to an actual type at runtime. This also includes the ability to define aggregates using the polymorphic functions. 2. Array handling functions: - singleton_array(ANYELEMENT) returns ANYARRAY - array_push(ANYARRAY, ANYELEMENT) returns ANYARRAY - array_accum(ANYARRAY, ANYELEMENT) returns ANYARRAY - array_assign(ANYARRAY, int, ANYELEMENT) returns ANYARRAY - array_subscript(ANYARRAY, int) returns ANYELEMENT 3. Grammar and underlying support for the following (examples): create table foo(f1 integer ARRAY); create table foo(f1 integer ARRAY[]); create table foo(f1 integer ARRAY[x]); create table foo(f1 integer ARRAY[][]); (and more [] etc) create table foo(f1 integer ARRAY[x][y]); (and more [] etc) select ARRAY[1,2,3]; select ARRAY[[1,2,3],[4,5,6]]; select ARRAY[ARRAY[1,2,3],ARRAY[4,5,6]]; etc up to 6 dimensions select ARRAY(select oid from pg_class order by relname); Yet-to-come: --------------------------------- 1. Functions: - str_to_array(str TEXT, delim TEXT) returns TEXT[] - array_to_str(array ANYARRAY, delim TEXT) returns TEXT 2. Grammar: select ARRAY[1,2] || 3; select ARRAY[1,2] || ARRAY[3,4]; select ARRAY[[1,2],[3,4]] || 5; select ARRAY[[1,2],[3,4]] || [5,6] 3. Documentation update: Update "User's Guide"->"Data Types"->"Arrays" documentation create a new section: "User's Guide"-> "Functions and Operators"-> "Array Functions and Operators" 4. PL/pgSQL support for polymorphic types 5. SQL function support for polymorphic types. 6. Move as much of contrib/array into backend as makes sense (I haven't looked too close yet), including migration to use polymorphic semantics. 7. Move as much of contrib/intarray into backend as makes sense (I haven't looked too close yet), including migration to use polymorphic semantics (therefore make work on other than int where possible). 8. Additional documentation and regression test updates Thanks, Joe
Вложения
В списке pgsql-patches по дате отправления: