bug fixes
This commit is contained in:
parent
a4cbb1ab05
commit
7beede0306
4 changed files with 58 additions and 5 deletions
|
@ -85,12 +85,45 @@ CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql VOLATILE;
|
|||
(identifier)
|
||||
(function_volatility)))
|
||||
|
||||
================================================================================
|
||||
returns array
|
||||
================================================================================
|
||||
CREATE FUNCTION FOO () RETURNS text[] AS 'select' LANGUAGE sql;
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(create_function_statement
|
||||
(function_signature
|
||||
(identifier)
|
||||
(function_parameters))
|
||||
(function_return
|
||||
(identifier))
|
||||
(string)
|
||||
(identifier)))
|
||||
|
||||
================================================================================
|
||||
returns setof
|
||||
================================================================================
|
||||
CREATE FUNCTION FOO () RETURNS SETOF text AS 'select' LANGUAGE sql;
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(create_function_statement
|
||||
(function_signature
|
||||
(identifier)
|
||||
(function_parameters))
|
||||
(function_return
|
||||
(return_setof
|
||||
(identifier)))
|
||||
(string)
|
||||
(identifier)))
|
||||
|
||||
================================================================================
|
||||
returns setof array
|
||||
================================================================================
|
||||
CREATE FUNCTION FOO () RETURNS SETOF text[] AS 'select' LANGUAGE sql;
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(create_function_statement
|
||||
(function_signature
|
||||
|
|
|
@ -141,7 +141,7 @@ do $$ begin
|
|||
execute format(
|
||||
$sql$
|
||||
update %1$s
|
||||
set foo = $1
|
||||
set foo = $1, %2$I = $1
|
||||
$sql$
|
||||
, _tbl_name) using bar;
|
||||
end $$;
|
||||
|
|
|
@ -78,6 +78,25 @@ insert from select
|
|||
insert into foo.my_table select column1 from foo bar;
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(insert_statement
|
||||
(identifier)
|
||||
(insert_items
|
||||
(select_statement
|
||||
(select_item
|
||||
(identifier))
|
||||
(select_from
|
||||
(from_item
|
||||
(from_table
|
||||
(identifier)
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
insert from select(1)
|
||||
================================================================================
|
||||
insert into foo.my_table (select column1 from foo bar);
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(insert_statement
|
||||
(identifier)
|
||||
|
|
|
@ -114,7 +114,8 @@ module.exports = grammar({
|
|||
insert_items: $ => choice(
|
||||
seq(kw("default"), kw("values")),
|
||||
seq(kw("values"), "(", commaSep($.insert_item), ")"),
|
||||
$.select_statement
|
||||
$.select_statement,
|
||||
seq("(", $.select_statement, ")"),
|
||||
),
|
||||
insert_item: $ => choice(
|
||||
kw("default"),
|
||||
|
@ -605,12 +606,12 @@ module.exports = grammar({
|
|||
function_return: $ => seq(
|
||||
kw("returns"),
|
||||
choice(
|
||||
$.identifier,
|
||||
$._type,
|
||||
$.return_setof,
|
||||
$.return_table,
|
||||
),
|
||||
),
|
||||
return_setof: $ => seq(kw("setof"), $.identifier),
|
||||
return_setof: $ => seq(kw("setof"), $._type),
|
||||
return_table: $ => seq(kw("table"), "(", commaSep1($.var_declaration), ")"),
|
||||
|
||||
function_volatility: $ => choice(
|
||||
|
@ -755,7 +756,7 @@ module.exports = grammar({
|
|||
// TODO(chrde): it does not handle nested dollar quotes... perhaps move to an external scanner?
|
||||
dollar_quote_string: $ => seq(
|
||||
"$", $._identifier, "$",
|
||||
/(([^$]+)|(%\d+\$s)|(\$\d+))+/,
|
||||
/(([^$]+)|(%\d+\$[sI])|(\$\d+))+/,
|
||||
// ^
|
||||
// |- matches $1 (execute ... using placeholders)
|
||||
// ^
|
||||
|
|
Loading…
Reference in a new issue