Fixed incorrect argument handling in SET command if argument is a variable.
This commit is contained in:
parent
a3faf37f49
commit
ef0dcf0e5b
@ -2366,6 +2366,10 @@ Wed, 04 Jun 2008 14:22:30 +0200
|
||||
Tue, 24 Jun 2008 13:30:51 +0200
|
||||
|
||||
- Synced parser.
|
||||
|
||||
Tue, 19 Aug 2008 12:32:24 +0200
|
||||
|
||||
- Fixed incorrect argument handling in SET command if argument is a variable.
|
||||
- Set pgtypes library version to 3.1.
|
||||
- Set compat library version to 3.1.
|
||||
- Set ecpg library version to 6.2.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.369 2008/07/16 01:30:23 tgl Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.370 2008/08/19 10:40:32 meskes Exp $ */
|
||||
|
||||
/* Copyright comment */
|
||||
%{
|
||||
@ -1247,7 +1247,16 @@ iso_level: READ UNCOMMITTED { $$ = make_str("read uncommitted"); }
|
||||
;
|
||||
|
||||
var_value: opt_boolean { $$ = $1; }
|
||||
| AllConst { $$ = $1; }
|
||||
| AllConst { /* we have to check for a variable here because it has to be
|
||||
replaced with its value on the client side */
|
||||
if ($1[1] == '$')
|
||||
{
|
||||
$$ = make_str("$0");
|
||||
free($1);
|
||||
}
|
||||
else
|
||||
$$ = $1;
|
||||
}
|
||||
| ColId { $$ = $1; }
|
||||
;
|
||||
|
||||
|
@ -24,10 +24,10 @@
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
/* exec sql begin declare section */
|
||||
|
||||
|
||||
|
||||
#line 9 "show.pgc"
|
||||
char var [ 25 ] ;
|
||||
char var [ 25 ] = "public" ;
|
||||
/* exec sql end declare section */
|
||||
#line 10 "show.pgc"
|
||||
|
||||
@ -44,7 +44,9 @@ int main(int argc, char* argv[]) {
|
||||
#line 16 "show.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to $0",
|
||||
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 18 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
@ -66,7 +68,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
|
||||
printf("Var: Search path: %s\n", var);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 22 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
@ -75,71 +77,93 @@ if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 22 "show.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT,
|
||||
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 23 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 23 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 23 "show.pgc"
|
||||
|
||||
printf("Var: Search path: %s\n", var);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 26 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 26 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 26 "show.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT,
|
||||
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 23 "show.pgc"
|
||||
#line 27 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 23 "show.pgc"
|
||||
#line 27 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 23 "show.pgc"
|
||||
#line 27 "show.pgc"
|
||||
|
||||
printf("Var: Standard conforming strings: %s\n", var);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 26 "show.pgc"
|
||||
#line 30 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 26 "show.pgc"
|
||||
#line 30 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 26 "show.pgc"
|
||||
#line 30 "show.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show time zone", ECPGt_EOIT,
|
||||
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 27 "show.pgc"
|
||||
#line 31 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 27 "show.pgc"
|
||||
#line 31 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 27 "show.pgc"
|
||||
#line 31 "show.pgc"
|
||||
|
||||
printf("Time Zone: %s\n", var);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set transaction isolation level read committed", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 30 "show.pgc"
|
||||
#line 34 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 30 "show.pgc"
|
||||
#line 34 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 30 "show.pgc"
|
||||
#line 34 "show.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show transaction isolation level", ECPGt_EOIT,
|
||||
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 31 "show.pgc"
|
||||
#line 35 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 31 "show.pgc"
|
||||
#line 35 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 31 "show.pgc"
|
||||
#line 35 "show.pgc"
|
||||
|
||||
printf("Transaction isolation level: %s\n", var);
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "ALL");
|
||||
#line 34 "show.pgc"
|
||||
#line 38 "show.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 34 "show.pgc"
|
||||
#line 38 "show.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 34 "show.pgc"
|
||||
#line 38 "show.pgc"
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -2,7 +2,7 @@
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 18: query: set search_path to 'public'; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 18: query: set search_path to public; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 18: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
@ -16,47 +16,61 @@
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 19: RESULT: public offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 22: query: set standard_conforming_strings to off; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 22: query: set search_path to 'public'; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 22: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 22: OK: SET
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 23: query: show standard_conforming_strings; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 23: query: show search_path; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 23: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 23: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 23: RESULT: off offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 23: RESULT: public offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 26: query: set time zone PST8PDT; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 26: query: set standard_conforming_strings to off; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 26: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 26: OK: SET
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 27: query: show time zone; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 27: query: show standard_conforming_strings; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 27: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 27: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 27: RESULT: PST8PDT offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 27: RESULT: off offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 30: query: set transaction isolation level read committed; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 30: query: set time zone PST8PDT; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 30: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 30: OK: SET
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 31: query: show transaction isolation level; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 31: query: show time zone; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 31: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 31: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 31: RESULT: read committed offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 31: RESULT: PST8PDT offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 34: query: set transaction isolation level read committed; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 34: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 34: OK: SET
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 35: query: show transaction isolation level; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 35: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 35: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 35: RESULT: read committed offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: connection regress1 closed
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -1,4 +1,5 @@
|
||||
Var: Search path: public
|
||||
Var: Search path: public
|
||||
Var: Standard conforming strings: off
|
||||
Time Zone: PST8PDT
|
||||
Transaction isolation level: read committed
|
||||
|
@ -6,7 +6,7 @@ EXEC SQL INCLUDE ../regression;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char var[25];
|
||||
char var[25] = "public";
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
@ -15,6 +15,10 @@ int main(int argc, char* argv[]) {
|
||||
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
|
||||
EXEC SQL WHENEVER SQLERROR SQLPRINT;
|
||||
|
||||
EXEC SQL SET search_path TO :var;
|
||||
EXEC SQL SHOW search_path INTO :var;
|
||||
printf("Var: Search path: %s\n", var);
|
||||
|
||||
EXEC SQL SET search_path TO 'public';
|
||||
EXEC SQL SHOW search_path INTO :var;
|
||||
printf("Var: Search path: %s\n", var);
|
||||
|
Loading…
x
Reference in New Issue
Block a user