Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b9a36693
Commit
b9a36693
authored
Feb 18, 2009
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Message wordsmithing
parent
5c89839a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
58 deletions
+52
-58
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/gram.y
+12
-12
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_comp.c
+5
-5
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_exec.c
+22
-28
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/pl_funcs.c
+3
-3
src/pl/plpgsql/src/pl_handler.c
src/pl/plpgsql/src/pl_handler.c
+3
-3
src/pl/plpgsql/src/scan.l
src/pl/plpgsql/src/scan.l
+3
-3
src/test/regress/expected/plpgsql.out
src/test/regress/expected/plpgsql.out
+4
-4
No files found.
src/pl/plpgsql/src/gram.y
View file @
b9a36693
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.12
0 2009/02/02 20:25:38 tgl
Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.12
1 2009/02/18 11:33:04 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1043,7 +1043,7 @@ for_control :
...
@@ -1043,7 +1043,7 @@ for_control :
if ($2.scalar && $2.row)
if ($2.scalar && $2.row)
ereport(ERROR,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cursor FOR loop must have
just
one target variable")));
errmsg("cursor FOR loop must have
only
one target variable")));
/* create loop's private RECORD variable */
/* create loop's private RECORD variable */
plpgsql_convert_ident($2.name, &varname, 1);
plpgsql_convert_ident($2.name, &varname, 1);
...
@@ -1131,7 +1131,7 @@ for_control :
...
@@ -1131,7 +1131,7 @@ for_control :
if ($2.scalar && $2.row)
if ($2.scalar && $2.row)
ereport(ERROR,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("integer FOR loop must have
just
one target variable")));
errmsg("integer FOR loop must have
only
one target variable")));
/* create loop's private variable */
/* create loop's private variable */
plpgsql_convert_ident($2.name, &varname, 1);
plpgsql_convert_ident($2.name, &varname, 1);
...
@@ -1570,7 +1570,7 @@ stmt_open : K_OPEN lno cursor_variable
...
@@ -1570,7 +1570,7 @@ stmt_open : K_OPEN lno cursor_variable
(errcode(ERRCODE_SYNTAX_ERROR),
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error at \"%s\"",
errmsg("syntax error at \"%s\"",
yytext),
yytext),
errdetail("Expected
FOR
to open a reference cursor.")));
errdetail("Expected
\"FOR\",
to open a reference cursor.")));
}
}
tok = yylex();
tok = yylex();
...
@@ -1664,7 +1664,7 @@ cursor_variable : T_SCALAR
...
@@ -1664,7 +1664,7 @@ cursor_variable : T_SCALAR
plpgsql_error_lineno = plpgsql_scanner_lineno();
plpgsql_error_lineno = plpgsql_scanner_lineno();
ereport(ERROR,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("\"%s\" must be of type cursor or refcursor",
errmsg("
variable
\"%s\" must be of type cursor or refcursor",
((PLpgSQL_var *) yylval.scalar)->refname)));
((PLpgSQL_var *) yylval.scalar)->refname)));
}
}
$$ = (PLpgSQL_var *) yylval.scalar;
$$ = (PLpgSQL_var *) yylval.scalar;
...
@@ -2094,7 +2094,7 @@ read_datatype(int tok)
...
@@ -2094,7 +2094,7 @@ read_datatype(int tok)
if (parenlevel != 0)
if (parenlevel != 0)
yyerror("mismatched parentheses");
yyerror("mismatched parentheses");
else
else
yyerror("incomplete datatype declaration");
yyerror("incomplete data
type declaration");
}
}
/* Possible followers for datatype in a declaration */
/* Possible followers for datatype in a declaration */
if (tok == K_NOT || tok == K_ASSIGN || tok == K_DEFAULT)
if (tok == K_NOT || tok == K_ASSIGN || tok == K_DEFAULT)
...
@@ -2119,7 +2119,7 @@ read_datatype(int tok)
...
@@ -2119,7 +2119,7 @@ read_datatype(int tok)
type_name = plpgsql_dstring_get(&ds);
type_name = plpgsql_dstring_get(&ds);
if (type_name[0] == '\0')
if (type_name[0] == '\0')
yyerror("missing datatype declaration");
yyerror("missing data
type declaration");
plpgsql_error_lineno = lno; /* in case of error in parse_datatype */
plpgsql_error_lineno = lno; /* in case of error in parse_datatype */
...
@@ -2375,11 +2375,11 @@ make_return_stmt(int lineno)
...
@@ -2375,11 +2375,11 @@ make_return_stmt(int lineno)
break;
break;
default:
default:
yyerror("RETURN must specify a record or row variable in function returning
tuple
");
yyerror("RETURN must specify a record or row variable in function returning
row
");
break;
break;
}
}
if (yylex() != ';')
if (yylex() != ';')
yyerror("RETURN must specify a record or row variable in function returning
tuple
");
yyerror("RETURN must specify a record or row variable in function returning
row
");
}
}
else
else
{
{
...
@@ -2428,11 +2428,11 @@ make_return_next_stmt(int lineno)
...
@@ -2428,11 +2428,11 @@ make_return_next_stmt(int lineno)
break;
break;
default:
default:
yyerror("RETURN NEXT must specify a record or row variable in function returning
tuple
");
yyerror("RETURN NEXT must specify a record or row variable in function returning
row
");
break;
break;
}
}
if (yylex() != ';')
if (yylex() != ';')
yyerror("RETURN NEXT must specify a record or row variable in function returning
tuple
");
yyerror("RETURN NEXT must specify a record or row variable in function returning
row
");
}
}
else
else
new->expr = plpgsql_read_expression(';', ";");
new->expr = plpgsql_read_expression(';', ";");
...
@@ -2745,7 +2745,7 @@ check_label(const char *yytxt)
...
@@ -2745,7 +2745,7 @@ check_label(const char *yytxt)
plpgsql_convert_ident(yytxt, &label_name, 1);
plpgsql_convert_ident(yytxt, &label_name, 1);
if (plpgsql_ns_lookup_label(label_name) == NULL)
if (plpgsql_ns_lookup_label(label_name) == NULL)
yyerror("
no such label
");
yyerror("
label does not exist
");
return label_name;
return label_name;
}
}
...
...
src/pl/plpgsql/src/pl_comp.c
View file @
b9a36693
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.13
3 2009/01/01 17:24:03 momjian
Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.13
4 2009/02/18 11:33:04 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -415,7 +415,7 @@ do_compile(FunctionCallInfo fcinfo,
...
@@ -415,7 +415,7 @@ do_compile(FunctionCallInfo fcinfo,
argdtype
->
ttype
!=
PLPGSQL_TTYPE_ROW
)
argdtype
->
ttype
!=
PLPGSQL_TTYPE_ROW
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"
plpgsql functions cannot take
type %s"
,
errmsg
(
"
PL/pgSQL functions cannot accept
type %s"
,
format_type_be
(
argtypeid
))));
format_type_be
(
argtypeid
))));
/* Build variable and add to datum list */
/* Build variable and add to datum list */
...
@@ -534,7 +534,7 @@ do_compile(FunctionCallInfo fcinfo,
...
@@ -534,7 +534,7 @@ do_compile(FunctionCallInfo fcinfo,
else
else
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"
plpgsql
functions cannot return type %s"
,
errmsg
(
"
PL/pgSQL
functions cannot return type %s"
,
format_type_be
(
rettypeid
))));
format_type_be
(
rettypeid
))));
}
}
...
@@ -576,7 +576,7 @@ do_compile(FunctionCallInfo fcinfo,
...
@@ -576,7 +576,7 @@ do_compile(FunctionCallInfo fcinfo,
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_FUNCTION_DEFINITION
),
(
errcode
(
ERRCODE_INVALID_FUNCTION_DEFINITION
),
errmsg
(
"trigger functions cannot have declared arguments"
),
errmsg
(
"trigger functions cannot have declared arguments"
),
errhint
(
"
You probably want to use
TG_NARGS and TG_ARGV instead."
)));
errhint
(
"
The arguments of the trigger can be accessed through
TG_NARGS and TG_ARGV instead."
)));
/* Add the record for referencing NEW */
/* Add the record for referencing NEW */
rec
=
plpgsql_build_record
(
"new"
,
0
,
true
);
rec
=
plpgsql_build_record
(
"new"
,
0
,
true
);
...
@@ -766,7 +766,7 @@ plpgsql_compile_error_callback(void *arg)
...
@@ -766,7 +766,7 @@ plpgsql_compile_error_callback(void *arg)
}
}
if
(
plpgsql_error_funcname
)
if
(
plpgsql_error_funcname
)
errcontext
(
"compil
e
of PL/pgSQL function
\"
%s
\"
near line %d"
,
errcontext
(
"compil
ation
of PL/pgSQL function
\"
%s
\"
near line %d"
,
plpgsql_error_funcname
,
plpgsql_error_lineno
);
plpgsql_error_funcname
,
plpgsql_error_lineno
);
}
}
...
...
src/pl/plpgsql/src/pl_exec.c
View file @
b9a36693
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.23
3 2009/02/17 12:51:59
petere Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.23
4 2009/02/18 11:33:04
petere Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -706,7 +706,7 @@ plpgsql_exec_trigger(PLpgSQL_function *func,
...
@@ -706,7 +706,7 @@ plpgsql_exec_trigger(PLpgSQL_function *func,
{
{
validate_tupdesc_compat
(
trigdata
->
tg_relation
->
rd_att
,
validate_tupdesc_compat
(
trigdata
->
tg_relation
->
rd_att
,
estate
.
rettupdesc
,
estate
.
rettupdesc
,
"returned
tuple structure does not match table of trigger event
"
);
"returned
row structure does not match the structure of the triggering table
"
);
/* Copy tuple to upper executor memory */
/* Copy tuple to upper executor memory */
rettup
=
SPI_copytuple
((
HeapTuple
)
DatumGetPointer
(
estate
.
retval
));
rettup
=
SPI_copytuple
((
HeapTuple
)
DatumGetPointer
(
estate
.
retval
));
}
}
...
@@ -765,24 +765,18 @@ plpgsql_exec_error_callback(void *arg)
...
@@ -765,24 +765,18 @@ plpgsql_exec_error_callback(void *arg)
*/
*/
if
(
estate
->
err_stmt
!=
NULL
)
if
(
estate
->
err_stmt
!=
NULL
)
{
{
/*
/* translator: last %s is a phrase such as "during statement block local variable initialization" */
* translator: last %s is a phrase such as "during statement block
* local variable initialization"
*/
errcontext
(
"PL/pgSQL function
\"
%s
\"
line %d %s"
,
errcontext
(
"PL/pgSQL function
\"
%s
\"
line %d %s"
,
estate
->
err_func
->
fn_name
,
estate
->
err_func
->
fn_name
,
estate
->
err_stmt
->
lineno
,
estate
->
err_stmt
->
lineno
,
gettext
(
estate
->
err_text
));
_
(
estate
->
err_text
));
}
}
else
else
{
{
/*
/* translator: last %s is a phrase such as "while storing call arguments into local variables" */
* translator: last %s is a phrase such as "while storing call
* arguments into local variables"
*/
errcontext
(
"PL/pgSQL function
\"
%s
\"
%s"
,
errcontext
(
"PL/pgSQL function
\"
%s
\"
%s"
,
estate
->
err_func
->
fn_name
,
estate
->
err_func
->
fn_name
,
gettext
(
estate
->
err_text
));
_
(
estate
->
err_text
));
}
}
}
}
else
if
(
estate
->
err_stmt
!=
NULL
)
else
if
(
estate
->
err_stmt
!=
NULL
)
...
@@ -1677,7 +1671,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
...
@@ -1677,7 +1671,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"lower bound of FOR loop cannot be
NULL
"
)));
errmsg
(
"lower bound of FOR loop cannot be
null
"
)));
loop_value
=
DatumGetInt32
(
value
);
loop_value
=
DatumGetInt32
(
value
);
exec_eval_cleanup
(
estate
);
exec_eval_cleanup
(
estate
);
...
@@ -1692,7 +1686,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
...
@@ -1692,7 +1686,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"upper bound of FOR loop cannot be
NULL
"
)));
errmsg
(
"upper bound of FOR loop cannot be
null
"
)));
end_value
=
DatumGetInt32
(
value
);
end_value
=
DatumGetInt32
(
value
);
exec_eval_cleanup
(
estate
);
exec_eval_cleanup
(
estate
);
...
@@ -1709,7 +1703,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
...
@@ -1709,7 +1703,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"BY value of FOR loop cannot be
NULL
"
)));
errmsg
(
"BY value of FOR loop cannot be
null
"
)));
step_value
=
DatumGetInt32
(
value
);
step_value
=
DatumGetInt32
(
value
);
exec_eval_cleanup
(
estate
);
exec_eval_cleanup
(
estate
);
if
(
step_value
<=
0
)
if
(
step_value
<=
0
)
...
@@ -2470,7 +2464,7 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
...
@@ -2470,7 +2464,7 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
if
(
optionisnull
)
if
(
optionisnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"RAISE statement option cannot be
NULL
"
)));
errmsg
(
"RAISE statement option cannot be
null
"
)));
extval
=
convert_value_to_string
(
optionvalue
,
optiontypeid
);
extval
=
convert_value_to_string
(
optionvalue
,
optiontypeid
);
...
@@ -2916,7 +2910,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
...
@@ -2916,7 +2910,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"
cannot EXECUTE a null querystring
"
)));
errmsg
(
"
query string argument of EXECUTE is null
"
)));
/* Get the C-String representation */
/* Get the C-String representation */
querystr
=
convert_value_to_string
(
query
,
restype
);
querystr
=
convert_value_to_string
(
query
,
restype
);
...
@@ -2981,7 +2975,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
...
@@ -2981,7 +2975,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
if
(
*
ptr
==
'S'
||
*
ptr
==
's'
)
if
(
*
ptr
==
'S'
||
*
ptr
==
's'
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"EXECUTE of SELECT ... INTO is not implemented
yet
"
)));
errmsg
(
"EXECUTE of SELECT ... INTO is not implemented"
)));
break
;
break
;
}
}
...
@@ -3166,7 +3160,7 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
...
@@ -3166,7 +3160,7 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"
cannot EXECUTE a null querystring
"
)));
errmsg
(
"
query string argument of EXECUTE is null
"
)));
/* Get the C-String representation */
/* Get the C-String representation */
querystr
=
convert_value_to_string
(
queryD
,
restype
);
querystr
=
convert_value_to_string
(
queryD
,
restype
);
...
@@ -3300,7 +3294,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
...
@@ -3300,7 +3294,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
if
(
curvar
->
isnull
)
if
(
curvar
->
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"cursor variable
\"
%s
\"
is
NULL
"
,
curvar
->
refname
)));
errmsg
(
"cursor variable
\"
%s
\"
is
null
"
,
curvar
->
refname
)));
curname
=
TextDatumGetCString
(
curvar
->
value
);
curname
=
TextDatumGetCString
(
curvar
->
value
);
portal
=
SPI_cursor_find
(
curname
);
portal
=
SPI_cursor_find
(
curname
);
...
@@ -3321,7 +3315,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
...
@@ -3321,7 +3315,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"relative or absolute cursor position is
NULL
"
)));
errmsg
(
"relative or absolute cursor position is
null
"
)));
exec_eval_cleanup
(
estate
);
exec_eval_cleanup
(
estate
);
}
}
...
@@ -3396,7 +3390,7 @@ exec_stmt_close(PLpgSQL_execstate *estate, PLpgSQL_stmt_close *stmt)
...
@@ -3396,7 +3390,7 @@ exec_stmt_close(PLpgSQL_execstate *estate, PLpgSQL_stmt_close *stmt)
if
(
curvar
->
isnull
)
if
(
curvar
->
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"cursor variable
\"
%s
\"
is
NULL
"
,
curvar
->
refname
)));
errmsg
(
"cursor variable
\"
%s
\"
is
null
"
,
curvar
->
refname
)));
curname
=
TextDatumGetCString
(
curvar
->
value
);
curname
=
TextDatumGetCString
(
curvar
->
value
);
portal
=
SPI_cursor_find
(
curname
);
portal
=
SPI_cursor_find
(
curname
);
...
@@ -3463,7 +3457,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
...
@@ -3463,7 +3457,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
if
(
*
isNull
&&
var
->
notnull
)
if
(
*
isNull
&&
var
->
notnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"
NULL
cannot be assigned to variable
\"
%s
\"
declared NOT NULL"
,
errmsg
(
"
null value
cannot be assigned to variable
\"
%s
\"
declared NOT NULL"
,
var
->
refname
)));
var
->
refname
)));
/*
/*
...
@@ -3720,8 +3714,8 @@ exec_assign_value(PLpgSQL_execstate *estate,
...
@@ -3720,8 +3714,8 @@ exec_assign_value(PLpgSQL_execstate *estate,
if
(
nsubscripts
>=
MAXDIM
)
if
(
nsubscripts
>=
MAXDIM
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_PROGRAM_LIMIT_EXCEEDED
),
(
errcode
(
ERRCODE_PROGRAM_LIMIT_EXCEEDED
),
errmsg
(
"number of array dimensions
exceeds the maximum allowed, %d
"
,
errmsg
(
"number of array dimensions
(%d) exceeds the maximum allowed (%d)
"
,
MAXDIM
)));
nsubscripts
,
MAXDIM
)));
subscripts
[
nsubscripts
++
]
=
arrayelem
->
subscript
;
subscripts
[
nsubscripts
++
]
=
arrayelem
->
subscript
;
target
=
estate
->
datums
[
arrayelem
->
arrayparentno
];
target
=
estate
->
datums
[
arrayelem
->
arrayparentno
];
}
while
(
target
->
dtype
==
PLPGSQL_DTYPE_ARRAYELEM
);
}
while
(
target
->
dtype
==
PLPGSQL_DTYPE_ARRAYELEM
);
...
@@ -3757,7 +3751,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
...
@@ -3757,7 +3751,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
if
(
subisnull
)
if
(
subisnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"array subscript in assignment must not be
NULL
"
)));
errmsg
(
"array subscript in assignment must not be
null
"
)));
}
}
/* Coerce source value to match array element type. */
/* Coerce source value to match array element type. */
...
@@ -5129,7 +5123,7 @@ static void
...
@@ -5129,7 +5123,7 @@ static void
validate_tupdesc_compat
(
TupleDesc
expected
,
TupleDesc
returned
,
const
char
*
msg
)
validate_tupdesc_compat
(
TupleDesc
expected
,
TupleDesc
returned
,
const
char
*
msg
)
{
{
int
i
;
int
i
;
const
char
*
dropped_column_type
=
gettext_noop
(
"
n/a
(dropped column)"
);
const
char
*
dropped_column_type
=
gettext_noop
(
"
N/A
(dropped column)"
);
if
(
!
expected
||
!
returned
)
if
(
!
expected
||
!
returned
)
ereport
(
ERROR
,
ereport
(
ERROR
,
...
@@ -5402,7 +5396,7 @@ exec_dynquery_with_params(PLpgSQL_execstate *estate, PLpgSQL_expr *dynquery,
...
@@ -5402,7 +5396,7 @@ exec_dynquery_with_params(PLpgSQL_execstate *estate, PLpgSQL_expr *dynquery,
if
(
isnull
)
if
(
isnull
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
(
errcode
(
ERRCODE_NULL_VALUE_NOT_ALLOWED
),
errmsg
(
"
cannot EXECUTE a null querystring
"
)));
errmsg
(
"
query string argument of EXECUTE is null
"
)));
/* Get the C-String representation */
/* Get the C-String representation */
querystr
=
convert_value_to_string
(
query
,
restype
);
querystr
=
convert_value_to_string
(
query
,
restype
);
...
...
src/pl/plpgsql/src/pl_funcs.c
View file @
b9a36693
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.7
5 2009/01/01 17:24:04 momjian
Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.7
6 2009/02/18 11:33:04 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -356,7 +356,7 @@ plpgsql_ns_rename(char *oldname, char *newname)
...
@@ -356,7 +356,7 @@ plpgsql_ns_rename(char *oldname, char *newname)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
errmsg
(
"
there is no variable
\"
%s
\"
in the current block"
,
errmsg
(
"
variable
\"
%s
\"
does not exist
in the current block"
,
oldname
)));
oldname
)));
}
}
...
@@ -412,7 +412,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
...
@@ -412,7 +412,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
if
(
*
s
!=
'"'
)
/* should not happen if lexer checked */
if
(
*
s
!=
'"'
)
/* should not happen if lexer checked */
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"unterminated
\"
in
name
: %s"
,
sstart
)));
errmsg
(
"unterminated
\"
in
identifier
: %s"
,
sstart
)));
s
++
;
s
++
;
*
cp
=
'\0'
;
*
cp
=
'\0'
;
/* Truncate to NAMEDATALEN */
/* Truncate to NAMEDATALEN */
...
...
src/pl/plpgsql/src/pl_handler.c
View file @
b9a36693
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.4
3 2009/01/01 17:24:04 momjian
Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.4
4 2009/02/18 11:33:04 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -159,7 +159,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
...
@@ -159,7 +159,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
!
IsPolymorphicType
(
proc
->
prorettype
))
!
IsPolymorphicType
(
proc
->
prorettype
))
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"
plpgsql
functions cannot return type %s"
,
errmsg
(
"
PL/pgSQL
functions cannot return type %s"
,
format_type_be
(
proc
->
prorettype
))));
format_type_be
(
proc
->
prorettype
))));
}
}
...
@@ -174,7 +174,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
...
@@ -174,7 +174,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
if
(
!
IsPolymorphicType
(
argtypes
[
i
]))
if
(
!
IsPolymorphicType
(
argtypes
[
i
]))
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"
plpgsql functions cannot take
type %s"
,
errmsg
(
"
PL/pgSQL functions cannot accept
type %s"
,
format_type_be
(
argtypes
[
i
]))));
format_type_be
(
argtypes
[
i
]))));
}
}
}
}
...
...
src/pl/plpgsql/src/scan.l
View file @
b9a36693
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.6
6 2009/02/17 13:01:13
petere Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.6
7 2009/02/18 11:33:04
petere Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -254,7 +254,7 @@ dump { return O_DUMP; }
...
@@ -254,7 +254,7 @@ dump { return O_DUMP; }
plpgsql_error_lineno = start_lineno;
plpgsql_error_lineno = start_lineno;
ereport(ERROR,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("unterminated comment")));
errmsg("unterminated
/*
comment")));
}
}
/* ----------
/* ----------
...
@@ -293,7 +293,7 @@ dump { return O_DUMP; }
...
@@ -293,7 +293,7 @@ dump { return O_DUMP; }
plpgsql_error_lineno = start_lineno;
plpgsql_error_lineno = start_lineno;
ereport(ERROR,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("unterminated string")));
errmsg("unterminated
quoted
string")));
}
}
{dolqdelim} {
{dolqdelim} {
...
...
src/test/regress/expected/plpgsql.out
View file @
b9a36693
...
@@ -2700,7 +2700,7 @@ begin
...
@@ -2700,7 +2700,7 @@ begin
end loop flbl1;
end loop flbl1;
end;
end;
$$ language plpgsql;
$$ language plpgsql;
ERROR:
no such label
at or near "flbl1"
ERROR:
label does not exist
at or near "flbl1"
LINE 5: end loop flbl1;
LINE 5: end loop flbl1;
^
^
-- should fail: end label does not match start label
-- should fail: end label does not match start label
...
@@ -2714,7 +2714,7 @@ begin
...
@@ -2714,7 +2714,7 @@ begin
end;
end;
$$ language plpgsql;
$$ language plpgsql;
ERROR: end label "outer_label" differs from block's label "inner_label"
ERROR: end label "outer_label" differs from block's label "inner_label"
CONTEXT: compil
e
of PL/pgSQL function "end_label3" near line 6
CONTEXT: compil
ation
of PL/pgSQL function "end_label3" near line 6
-- should fail: end label on a block without a start label
-- should fail: end label on a block without a start label
create function end_label4() returns void as $$
create function end_label4() returns void as $$
<<outer_label>>
<<outer_label>>
...
@@ -2725,7 +2725,7 @@ begin
...
@@ -2725,7 +2725,7 @@ begin
end;
end;
$$ language plpgsql;
$$ language plpgsql;
ERROR: end label "outer_label" specified for unlabelled block
ERROR: end label "outer_label" specified for unlabelled block
CONTEXT: compil
e
of PL/pgSQL function "end_label4" near line 5
CONTEXT: compil
ation
of PL/pgSQL function "end_label4" near line 5
-- using list of scalars in fori and fore stmts
-- using list of scalars in fori and fore stmts
create function for_vect() returns void as $proc$
create function for_vect() returns void as $proc$
<<lbl>>declare a integer; b varchar; c varchar; r record;
<<lbl>>declare a integer; b varchar; c varchar; r record;
...
@@ -3266,7 +3266,7 @@ begin
...
@@ -3266,7 +3266,7 @@ begin
end;
end;
$$ language plpgsql;
$$ language plpgsql;
ERROR: cursor FOR loop must use a bound cursor variable
ERROR: cursor FOR loop must use a bound cursor variable
CONTEXT: compil
e
of PL/pgSQL function "forc_bad" near line 4
CONTEXT: compil
ation
of PL/pgSQL function "forc_bad" near line 4
-- test RETURN QUERY EXECUTE
-- test RETURN QUERY EXECUTE
create or replace function return_dquery()
create or replace function return_dquery()
returns setof int as $$
returns setof int as $$
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment