feat: Support accessing array items and fields of composite types through json operators

This is supported in select=, in filters and in order=.

Resolves #1543

Resolves #2075

Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
This commit is contained in:
Wolfgang Walther
2022-02-03 08:13:38 +01:00
committed by Wolfgang Walther
parent 87bd8e72cf
commit 9f1b5c0a81
7 changed files with 115 additions and 4 deletions
+6
View File
@@ -730,3 +730,9 @@ INSERT INTO test.clientinfo (id,clientid, other) values (1,1,'123 Main St'),(2,2
TRUNCATE TABLE test.chores CASCADE;
INSERT INTO test.chores (id, name, done) values (1, 'take out the garbage', true), (2, 'do the laundry', false), (3, 'wash the dishes', null);
TRUNCATE TABLE test.fav_numbers CASCADE;
INSERT INTO test.fav_numbers VALUES (ROW(0.5, 0.5), 'A'), (ROW(0.6, 0.6), 'B');
TRUNCATE TABLE test.arrays CASCADE;
INSERT INTO test.arrays VALUES (0, '{1,2,3}', '{{1,2,3},{4,5,6},{7,8,9}}'), (1, '{11,12,13}', '{{11,12,13},{14,15,16},{17,18,19}}');
+2
View File
@@ -19,6 +19,7 @@ GRANT ALL ON TABLE
, items3
, "articleStars"
, articles
, arrays
, auto_incrementing_pk
, clients
, comments
@@ -27,6 +28,7 @@ GRANT ALL ON TABLE
, compound_pk_view
, deferrable_unique_constraint
, empty_table
, fav_numbers
, has_count_column
, has_fk
, insertable_view_with_join
+18
View File
@@ -2427,3 +2427,21 @@ BEGIN
END IF;
END
$do$;
-- https://github.com/PostgREST/postgrest/issues/1543
CREATE TYPE complex AS (
r double precision,
i double precision
);
CREATE TABLE test.fav_numbers (
num complex,
person text
);
-- https://github.com/PostgREST/postgrest/issues/2075
create table test.arrays (
id int primary key,
numbers int[],
numbers_mult int[][]
);