Skip to content

allow running multiple statements in function#2501

Open
jennifersp wants to merge 5 commits intomainfrom
jennifer/mult
Open

allow running multiple statements in function#2501
jennifersp wants to merge 5 commits intomainfrom
jennifer/mult

Conversation

@jennifersp
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Main PR
covering_index_scan_postgres 1093.71/s 1103.60/s +0.9%
index_join_postgres 155.95/s 156.65/s +0.4%
index_join_scan_postgres 205.44/s 206.14/s +0.3%
index_scan_postgres 12.08/s 12.27/s +1.5%
oltp_point_select 2306.92/s 2314.82/s +0.3%
oltp_read_only 1832.15/s 1828.37/s -0.3%
select_random_points 128.73/s 129.52/s +0.6%
select_random_ranges 824.20/s 816.12/s -1.0%
table_scan_postgres 11.74/s 11.88/s +1.1%
types_table_scan_postgres 5.45/s 5.46/s +0.1%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Main PR
Total 42090 42090
Successful 17852 17907
Failures 24238 24183
Partial Successes1 5563 5572
Main PR
Successful 42.4139% 42.5445%
Failures 57.5861% 57.4555%

${\color{lightgreen}Progressions (57)}$

create_procedure

QUERY: CREATE OR REPLACE PROCEDURE ptest5(a int, b text, c int default 100)
LANGUAGE SQL
AS $$
INSERT INTO cp_test VALUES(a, b);
INSERT INTO cp_test VALUES(c, b);
$$;
QUERY: CALL ptest5(10, 'Hello', 20);
QUERY: CALL ptest5(10, 'Hello');
QUERY: CREATE PROCEDURE ptest9(OUT a int)
LANGUAGE SQL
AS $$
INSERT INTO cp_test VALUES (1, 'a');
SELECT 1;
$$;

object_address

QUERY: CREATE PROCEDURE addr_nsp.proc(int4) LANGUAGE SQL AS $$ $$;

rowtypes

QUERY: create temp table quadtable(f1 int, q quad);
QUERY: create temp table people (fn fullname, bd date);
QUERY: create temp table pp (f1 text);
QUERY: insert into pp values (repeat('abcdefghijkl', 100000));
QUERY: select ROW(1,2) < ROW(1,3) as true;
QUERY: select ROW(1,2) < ROW(1,NULL) as null;
QUERY: select ROW(1,2,3) < ROW(1,3,NULL) as true;
QUERY: select ROW(11,'ABC') < ROW(11,'DEF') as true;
QUERY: select ROW(12,'ABC') > ROW(11,'DEF') as true;
QUERY: select ROW(1,2,3) < ROW(1,NULL,4) as null;
QUERY: select ROW(1,2,3) <> ROW(1,NULL,4) as true;
QUERY: select ROW(1,2) = ROW(1,2::int8);
QUERY: select ROW(1,2) in (ROW(3,4), ROW(1,2));
QUERY: select ROW(1,2) in (ROW(3,4), ROW(1,2::int8));
QUERY: select thousand, tenthous from tenk1
where (thousand, tenthous) >= (997, 5000)
order by thousand, tenthous;
QUERY: create temp table test_table (a text, b text);
QUERY: insert into test_table values ('a', 'b');
QUERY: insert into test_table select 'a', null from generate_series(1,1000);
QUERY: insert into test_table values ('b', 'a');
QUERY: create index on test_table (a,b);
QUERY: set enable_sort = off;
QUERY: select a,b from test_table where (a,b) > ('a','a') order by a,b;
QUERY: reset enable_sort;
QUERY: select ROW();
QUERY: select ROW() IS NULL;
QUERY: select array[ row(1,2), row(3,4), row(5,6) ];
QUERY: select row(1,1.1) = any (array[ row(7,7.7), row(1,1.1), row(0,0.0) ]);
QUERY: select row(1,1.1) = any (array[ row(7,7.7), row(1,1.0), row(0,0.0) ]);
QUERY: create type testtype1 as (a int, b int);
QUERY: create type testtype3 as (a int, b text);
QUERY: create type testtype5 as (a int);
QUERY: create type testtype2 as (a smallint, b bool);
QUERY: CREATE TABLE price (
    id SERIAL PRIMARY KEY,
    active BOOLEAN NOT NULL,
    price NUMERIC
);
QUERY: CREATE TYPE price_input AS (
    id INTEGER,
    price NUMERIC
);
QUERY: CREATE TYPE price_key AS (
    id INTEGER
);

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

@jennifersp jennifersp requested a review from Hydrocharged April 2, 2026 23:27
Copy link
Copy Markdown
Collaborator

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Just a couple of small comments

// RowIter implements the interface sql.ExecSourceRel.
func (c *Call) RowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error) {
if !core.IsContextValid(ctx) {
if c.CompiledFunc == nil {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message doesn't match

}
}
if f.ReturnType.ID == pgtypes.Void.ID {
// TODO
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this TODO for? Not enough information to inform for the future

Comment on lines +837 to +839
} else {
// only if there is default, then append
if sqlFunc.ParameterDefaults[i] != "" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a single if inside of this else and nothing else, so we could change this to else if

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants