mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Allow SQL:2008 syntax ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE
alongside our traditional syntax.
This commit is contained in:
@ -101,7 +101,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
for (i=0; i<3; i++)
|
||||
printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T ", ECPGt_EOIT, ECPGt_EORT);
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter Item1 type bigint ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 31 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
@ -110,15 +110,34 @@ if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 31 "parser.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter column Item2 set data type smallint ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 32 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 32 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 32 "parser.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 34 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 34 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 34 "parser.pgc"
|
||||
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "ALL");
|
||||
#line 33 "parser.pgc"
|
||||
#line 36 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlwarn[0] == 'W') sqlprint();
|
||||
#line 33 "parser.pgc"
|
||||
#line 36 "parser.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 33 "parser.pgc"
|
||||
#line 36 "parser.pgc"
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -40,11 +40,23 @@
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 26: RESULT: offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 31: query: drop table T ; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 31: query: alter table T alter Item1 type bigint ; 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: OK: DROP TABLE
|
||||
[NO_PID]: ecpg_execute on line 31: OK: ALTER TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 32: query: alter table T alter column Item2 set data type smallint ; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 32: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 32: OK: ALTER TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 34: query: drop table T ; 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: DROP TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: connection regress1 closed
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -28,6 +28,9 @@ int main(int argc, char* argv[]) {
|
||||
for (i=0; i<3; i++)
|
||||
printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
|
||||
|
||||
EXEC SQL ALTER TABLE T ALTER Item1 TYPE bigint;
|
||||
EXEC SQL ALTER TABLE T ALTER COLUMN Item2 SET DATA TYPE smallint;
|
||||
|
||||
EXEC SQL DROP TABLE T;
|
||||
|
||||
EXEC SQL DISCONNECT ALL;
|
||||
|
Reference in New Issue
Block a user