diff options
| author | Tom Lane | 2004-05-10 22:44:49 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-05-10 22:44:49 +0000 |
| commit | 2f63232d30ca64a8f2684af855230f23a701d371 (patch) | |
| tree | b7a7707d1ec9edf368780cd3f4a23755527c5884 /src/test | |
| parent | 9a939886ac782cfee3cd5fdd1c58689163ed84be (diff) | |
Promote row expressions to full-fledged citizens of the expression syntax,
rather than allowing them only in a few special cases as before. In
particular you can now pass a ROW() construct to a function that accepts
a rowtype parameter. Internal generation of RowExprs fixes a number of
corner cases that used to not work very well, such as referencing the
whole-row result of a JOIN or subquery. This represents a further step in
the work I started a month or so back to make rowtype values into
first-class citizens.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/input/misc.source | 11 | ||||
| -rw-r--r-- | src/test/regress/output/constraints.source | 4 | ||||
| -rw-r--r-- | src/test/regress/output/misc.source | 39 |
3 files changed, 52 insertions, 2 deletions
diff --git a/src/test/regress/input/misc.source b/src/test/regress/input/misc.source index ebf13626c7f..cfaaea95131 100644 --- a/src/test/regress/input/misc.source +++ b/src/test/regress/input/misc.source @@ -219,6 +219,17 @@ SELECT hobbies_by_name('basketball'); SELECT name, overpaid(emp.*) FROM emp; -- +-- Try a few cases with SQL-spec row constructor expressions +-- +SELECT * FROM equipment(ROW('skywalking', 'mer')); + +SELECT name(equipment(ROW('skywalking', 'mer'))); + +SELECT *, name(equipment(h.*)) FROM hobbies_r h; + +SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h; + +-- -- check that old-style C functions work properly with TOASTed values -- create table oldstyle_test(i int4, t text); diff --git a/src/test/regress/output/constraints.source b/src/test/regress/output/constraints.source index 52ecabbd908..2237e0c5966 100644 --- a/src/test/regress/output/constraints.source +++ b/src/test/regress/output/constraints.source @@ -45,9 +45,9 @@ SELECT '' AS four, * FROM DEFAULTEXPR_TBL; -- syntax errors -- test for extraneous comma CREATE TABLE error_tbl (i int DEFAULT (100, )); -ERROR: syntax error at or near "," at character 43 +ERROR: syntax error at or near ")" at character 45 LINE 1: CREATE TABLE error_tbl (i int DEFAULT (100, )); - ^ + ^ -- this will fail because gram.y uses b_expr not a_expr for defaults, -- to avoid a shift/reduce conflict that arises from NOT NULL being -- part of the column definition syntax: diff --git a/src/test/regress/output/misc.source b/src/test/regress/output/misc.source index 3173f718c6c..0c1ed5deaf4 100644 --- a/src/test/regress/output/misc.source +++ b/src/test/regress/output/misc.source @@ -687,6 +687,45 @@ SELECT name, overpaid(emp.*) FROM emp; (6 rows) -- +-- Try a few cases with SQL-spec row constructor expressions +-- +SELECT * FROM equipment(ROW('skywalking', 'mer')); + name | hobby +------+------------ + guts | skywalking +(1 row) + +SELECT name(equipment(ROW('skywalking', 'mer'))); + name +------ + guts +(1 row) + +SELECT *, name(equipment(h.*)) FROM hobbies_r h; + name | person | name +-------------+--------+--------------- + posthacking | mike | advil + posthacking | mike | peet's coffee + posthacking | jeff | advil + posthacking | jeff | peet's coffee + basketball | joe | hightops + basketball | sally | hightops + skywalking | | guts +(7 rows) + +SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h; + name | person | name +-------------+--------+--------------- + posthacking | mike | advil + posthacking | mike | peet's coffee + posthacking | jeff | advil + posthacking | jeff | peet's coffee + basketball | joe | hightops + basketball | sally | hightops + skywalking | | guts +(7 rows) + +-- -- check that old-style C functions work properly with TOASTed values -- create table oldstyle_test(i int4, t text); |
