git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97eefd6)
ynced parser and keyword list.
Wed, 2 Aug 2006 13:43:23 +0000 (13:43 +0000)
Wed, 2 Aug 2006 13:43:23 +0000 (13:43 +0000)
Implemented EXEC SQL UNDEF.
Applied first version of the regression test patch by Joachim Wieland <joe@mcknight.de>.


diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 80d9ebc3facdab632a68cc16012c156da2a42dcb..7904efa1476ec6889045c499055a850c545a062d 100644 (file)
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -2052,5 +2052,17 @@ Fr Jul 28 11:00:51 CEST 2006
- COPY TO STDOUT works
- Connection identifier has to be unique
- Variables should be free'ed only once.
+
+Tu Aug 1 15:04:52 CEST 2006
+
+ - Applied patch by Joachim Wieland <joe@mcknight.de> to fix segfault
+ occuring when using --enable-thread-safety.
+
+We Aug 2 13:15:25 CEST 2006
+
+ - Synced parser and keyword list.
+ - Implemented EXEC SQL UNDEF.
+ - Applied first version of the regression test patch by Joachim
+ Wieland <joe@mcknight.de>.
- Set ecpg library version to 5.2.
- Set ecpg version to 4.2.1.
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index dcc70a5754486ba3c88540da0dcaace10922c13a..2192f0311f52fe5ee27ce259ddc806a2fafed650 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.31 2006年07月28日 10:10:42 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.32 2006年08月02日 13:43:22 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -26,6 +26,11 @@ ecpg_actual_connection_init(void)
{
pthread_key_create(&actual_connection_key, NULL);
}
+
+void ecpg_pthreads_init(void)
+{
+ pthread_once(&actual_connection_key_once, ecpg_actual_connection_init);
+}
#endif
static struct connection *
@@ -43,13 +48,10 @@ ecpg_get_connection_nr(const char *connection_name)
* connection and hope the user knows what they're doing (i.e. using
* their own mutex to protect that connection from concurrent accesses
*/
+ /* if !ret then we got the connection from TSD */
if (NULL == ret)
- {
- ECPGlog("no TSD connection, going for global\n");
+ /* no TSD connection, going for global */
ret = actual_connection;
- }
- else
- ECPGlog("got the TSD connection\n");
#else
ret = actual_connection;
#endif
@@ -84,13 +86,10 @@ ECPGget_connection(const char *connection_name)
* connection and hope the user knows what they're doing (i.e. using
* their own mutex to protect that connection from concurrent accesses
*/
+ /* if !ret then we got the connection from TSD */
if (NULL == ret)
- {
- ECPGlog("no TSD connection here either, using global\n");
+ /* no TSD connection here either, using global */
ret = actual_connection;
- }
- else
- ECPGlog("got TSD connection\n");
#else
ret = actual_connection;
#endif
@@ -298,6 +297,10 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
if (dbname == NULL && connection_name == NULL)
connection_name = "DEFAULT";
+#if ENABLE_THREAD_SAFETY
+ ecpg_pthreads_init();
+#endif
+
/* check if the identifier is unique */
if (ECPGget_connection(connection_name))
{
@@ -450,7 +453,6 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
all_connections = this;
#ifdef ENABLE_THREAD_SAFETY
- pthread_once(&actual_connection_key_once, ecpg_actual_connection_init);
pthread_setspecific(actual_connection_key, all_connections);
#endif
actual_connection = all_connections;
diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c
index 935452b46dfb7a4d04bec9f7df92e7a0f8081b37..5e65c0df8d4cf2a7fd6ceaf17051728d9f42ee03 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/error.c
+++ b/src/interfaces/ecpg/ecpglib/error.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.13 2006年07月14日 05:28:28 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.14 2006年08月02日 13:43:23 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -189,8 +189,8 @@ ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat)
else
sqlca->sqlcode = ECPG_PGSQL;
- ECPGlog("raising sqlstate %.*s in line %d, '%s'.\n",
- sizeof(sqlca->sqlstate), sqlca->sqlstate, line, sqlca->sqlerrm.sqlerrmc);
+ ECPGlog("raising sqlstate %.*s (sqlcode: %d) in line %d, '%s'.\n",
+ sizeof(sqlca->sqlstate), sqlca->sqlstate, sqlca->sqlcode, line, sqlca->sqlerrm.sqlerrmc);
/* free all memory we have allocated for the user */
ECPGfree_auto_mem();
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index e98646214d41e64b8f2ff18569ba7099a41177bc..93f912b891502e337f8784ef7a9b15d1b3177cf2 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.55 2006年07月28日 11:49:36 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.56 2006年08月02日 13:43:23 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -1465,7 +1465,7 @@ ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name,
{
va_list args;
struct statement *stmt;
- struct connection *con = ECPGget_connection(connection_name);
+ struct connection *con;
bool status;
char *oldlocale;
@@ -1474,6 +1474,12 @@ ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name,
oldlocale = ECPGstrdup(setlocale(LC_NUMERIC, NULL), lineno);
setlocale(LC_NUMERIC, "C");
+#ifdef ENABLE_THREAD_SAFETY
+ ecpg_pthreads_init();
+#endif
+
+ con = ECPGget_connection(connection_name);
+
if (!ECPGinit(con, connection_name, lineno))
{
setlocale(LC_NUMERIC, oldlocale);
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index 8998f400792e4e06380d65da1563e9aea22a0f6f..a60b4f0dee1fd3d131bdad72748f9498f5cdc170 100644 (file)
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -1,7 +1,7 @@
/*
* this is a small part of c.h since we don't want to leak all postgres
* definitions into ecpg programs
- * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.67 2006年07月11日 13:54:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.68 2006年08月02日 13:43:23 meskes Exp $
*/
#ifndef _ECPGLIB_H
@@ -85,6 +85,10 @@ bool ECPGdescribe(int, bool, const char *,...);
/* dynamic result allocation */
void ECPGfree_auto_mem(void);
+#ifdef ENABLE_THREAD_SAFETY
+void ecpg_pthreads_init();
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c
index a111576edc8697d15f0f113d24ee2b036372dfb7..a1879c99733ed9e61c8f18585c4a25a7e3096e6b 100644 (file)
--- a/src/interfaces/ecpg/preproc/keywords.c
+++ b/src/interfaces/ecpg/preproc/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.73 2006年03月05日 15:59:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.74 2006年08月02日 13:43:23 meskes Exp $
*
*-------------------------------------------------------------------------
*/
@@ -167,6 +167,7 @@ static ScanKeyword ScanKeywords[] = {
{"including", INCLUDING},
{"increment", INCREMENT},
{"index", INDEX},
+ {"indexes", INDEXES},
{"inherit", INHERIT},
{"inherits", INHERITS},
{"initially", INITIALLY},
@@ -324,7 +325,6 @@ static ScanKeyword ScanKeywords[] = {
{"time", TIME},
{"timestamp", TIMESTAMP},
{"to", TO},
- {"toast", TOAST},
{"trailing", TRAILING},
{"transaction", TRANSACTION},
{"treat", TREAT},
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index ee20840581b1f1bc4054096c517b077726733e08..5dff416f6bef2d9d40acca2c56e16dc98c8cb0ab 100644 (file)
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.147 2006年07月14日 05:28:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.148 2006年08月02日 13:43:23 meskes Exp $
*
*-------------------------------------------------------------------------
*/
@@ -79,7 +79,7 @@ static struct _if_value
%option yylineno
-%s C SQL incl def def_ident
+%s C SQL incl def def_ident undef
/*
* OK, here is a short description of lex/flex rules behavior.
@@ -285,6 +285,7 @@ exec [eE][xX][eE][cC]
sql [sS][qQ][lL]
define [dD][eE][fF][iI][nN][eE]
include [iI][nN][cC][lL][uU][dD][eE]
+undef [uU][nN][dD][eE][fF]
ifdef [iI][fF][dD][eE][fF]
ifndef [iI][fF][nN][dD][eE][fF]
@@ -837,7 +838,6 @@ cppline {space}*#(.*\\{space})*.*{newline}
<C>"->*" { return(S_MEMPOINT); }
<C>".*" { return(S_DOTPOINT); }
<C>{other} { return S_ANYTHING; }
-
<C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
<C>{informix_special}{define}{space}* {
/* are we simulating Informix? */
@@ -851,6 +851,55 @@ cppline {space}*#(.*\\{space})*.*{newline}
return (S_ANYTHING);
}
}
+<C>{exec_sql}{undef}{space}* { BEGIN(undef); }
+<C>{informix_special}{undef}{space}* {
+ /* are we simulating Informix? */
+ if (INFORMIX_MODE)
+ {
+ BEGIN(undef);
+ }
+ else
+ {
+ yyless(1);
+ return (S_ANYTHING);
+ }
+ }
+<undef>{identifier}{space}*";" {
+ struct _defines *ptr, *ptr2 = NULL;
+ int i;
+
+ /*
+ * Skip the ";" and trailing whitespace. Note that yytext
+ * contains at least one non-space character plus the ";"
+ */
+ for (i = strlen(yytext)-2;
+ i > 0 && isspace((unsigned char) yytext[i]);
+ i-- )
+ ;
+ yytext[i+1] = '0円';
+
+
+ for (ptr = defines; ptr != NULL; ptr2 = ptr, ptr = ptr->next)
+ {
+ if (strcmp(yytext, ptr->old) == 0)
+ {
+ if (ptr2 == NULL)
+ defines = ptr->next;
+ else
+ ptr2->next = ptr->next;
+ free(ptr->new);
+ free(ptr->old);
+ free(ptr);
+ break;
+ }
+ }
+
+ BEGIN(C);
+ }
+<undef>{other} {
+ mmerror(PARSE_ERROR, ET_FATAL, "Missing identifier in 'EXEC SQL UNDEF' command");
+ yyterminate();
+ }
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
<C>{informix_special}{include}{space}* {
/* are we simulating Informix? */
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 71712b1bb4a4345aa90887cd48e7c93928e05e7f..ce7484ca7878803c91a850915a7c4b074aa7d061 100644 (file)
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.326 2006年07月28日 09:08:01 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.327 2006年08月02日 13:43:23 meskes Exp $ */
/* Copyright comment */
%{
@@ -379,7 +379,7 @@ add_additional_variables(char *name, bool insert)
HANDLER HAVING HEADER_P HOLD HOUR_P
IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
- INDEX INHERIT INHERITS INITIALLY INNER_P INOUT INPUT_P
+ INDEX INDEXES INHERIT INHERITS INITIALLY INNER_P INOUT INPUT_P
INSENSITIVE INSERT INSTEAD INT_P INTEGER INTERSECT
INTERVAL INTO INVOKER IS ISNULL ISOLATION
@@ -416,7 +416,7 @@ add_additional_variables(char *name, bool insert)
STATISTICS STDIN STDOUT STORAGE STRICT_P SUBSTRING SUPERUSER_P SYMMETRIC
SYSID SYSTEM_P
- TABLE TABLESPACE TEMP TEMPLATE TEMPORARY THEN TIME TIMESTAMP TO TOAST
+ TABLE TABLESPACE TEMP TEMPLATE TEMPORARY THEN TIME TIMESTAMP TO
TRAILING TRANSACTION TREAT TRIGGER TRIM TRUE_P TRUNCATE TRUSTED TYPE_P
UNCOMMITTED UNENCRYPTED UNION UNIQUE UNKNOWN UNLISTEN UNTIL
@@ -497,9 +497,9 @@ add_additional_variables(char *name, bool insert)
%type <str> columnList DeleteStmt UpdateStmt DeclareCursorStmt
%type <str> NotifyStmt columnElem UnlistenStmt TableElement
%type <str> copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary
-%type <str> FetchStmt from_in CreateOpClassStmt like_including_defaults
+%type <str> FetchStmt from_in CreateOpClassStmt
%type <str> ClosePortalStmt DropStmt VacuumStmt AnalyzeStmt opt_verbose
-%type <str> opt_full func_arg OptWithOids opt_freeze alter_table_cmd
+%type <str> opt_full func_arg OptWith opt_freeze alter_table_cmd
%type <str> analyze_keyword opt_name_list ExplainStmt index_params
%type <str> index_elem opt_class access_method_clause alter_table_cmds
%type <str> index_opt_unique IndexStmt func_return ConstInterval
@@ -521,7 +521,7 @@ add_additional_variables(char *name, bool insert)
%type <str> CreatePLangStmt TriggerFuncArgs TriggerFuncArg simple_select
%type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_item ExplainableStmt
%type <str> createdb_opt_list opt_encoding OptInherit opt_equal
-%type <str> privilege_list privilege privilege_target
+%type <str> privilege_list privilege privilege_target opt_if_exists
%type <str> opt_grant_grant_option cursor_options DropOwnedStmt
%type <str> transaction_mode_list_or_empty transaction_mode_list
%type <str> function_with_argtypes_list function_with_argtypes IntConstVar
@@ -542,8 +542,8 @@ add_additional_variables(char *name, bool insert)
%type <str> select_limit CheckPointStmt ECPGColId old_aggr_list
%type <str> OptSchemaName OptSchemaEltList schema_stmt opt_drop_behavior
%type <str> handler_name any_name_list any_name opt_as insert_column_list
-%type <str> columnref function_name insert_target_el AllConstVar
-%type <str> insert_target_list insert_column_item DropRuleStmt
+%type <str> columnref function_name values_clause AllConstVar
+%type <str> values_list insert_column_item DropRuleStmt values_item
%type <str> createfunc_opt_item set_rest var_list_or_default alter_rel_cmd
%type <str> CreateFunctionStmt createfunc_opt_list func_table
%type <str> DropUserStmt copy_from copy_opt_list copy_opt_item
@@ -586,7 +586,7 @@ add_additional_variables(char *name, bool insert)
%type <str> AlterObjectSchemaStmt alterdb_opt_list for_locking_clause opt_for_locking_clause
%type <str> locked_rels_list opt_granted_by RevokeRoleStmt alterdb_opt_item using_clause
%type <str> GrantRoleStmt opt_asymmetric aggr_args aggr_args_list old_aggr_definition
-%type <str> old_aggr_elem for_locking_items
+%type <str> old_aggr_elem for_locking_items TableLikeOptionList TableLikeOption
%type <struct_union> s_struct_union_symbol
@@ -1292,9 +1292,6 @@ alter_table_cmd:
/* ALTER TABLE <relation> SET WITHOUT OIDS */
| SET WITHOUT OIDS
{ $$ = make_str("set without oids"); }
- /* ALTER TABLE <name> CREATE TOAST TABLE */
- | CREATE TOAST TABLE
- { $$ = make_str("create toast table"); }
/* ALTER TABLE <name> CLUSTER ON <indexname> */
| CLUSTER ON name
{ $$ = cat_str(2, make_str("cluster on"), 3ドル); }
@@ -1319,6 +1316,14 @@ alter_table_cmd:
/* ALTER TABLE <name> DISABLE TRIGGER USER */
| DISABLE_P TRIGGER USER
{ $$ = make_str("disable trigger user"); }
+/* ALTER TABLE <name> ALTER INHERITS ADD <parent> */
+ | INHERIT qualified_name
+ { $$ = cat2_str(make_str("inherit"), 2ドル); }
+/* ALTER TABLE <name> ALTER INHERITS DROP <parent> */
+ | NO INHERIT qualified_name
+ { $$ = cat2_str(make_str("no inherit"), 3ドル); }
+ | alter_rel_cmd
+ { $$ = 1ドル; }
;
alter_rel_cmds: alter_rel_cmd { $$ = 1ドル; }
@@ -1329,10 +1334,14 @@ alter_rel_cmds: alter_rel_cmd { $$ = 1ドル; }
alter_rel_cmd:
/* ALTER [TABLE|INDEX] <name> OWNER TO RoleId */
OWNER TO RoleId
- { $$ = cat_str(2, make_str("owner to"), 3ドル); }
+ { $$ = cat2_str(make_str("owner to"), 3ドル); }
/* ALTER [TABLE|INDEX] <name> SET TABLESPACE <tablespacename> */
| SET TABLESPACE name
- { $$ = cat_str(2, make_str("set tablespace"), 3ドル); }
+ { $$ = cat2_str(make_str("set tablespace"), 3ドル); }
+ | SET definition
+ { $$ = cat2_str(make_str("set"), 2ドル); }
+ | RESET definition
+ { $$ = cat2_str(make_str("reset"), 2ドル); }
;
alter_column_default:
@@ -1440,10 +1449,10 @@ opt_using: USING { $$ = make_str("using"); }
*****************************************************************************/
CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
- OptInherit OptWithOids OnCommitOption OptTableSpace
+ OptInherit OptWith OnCommitOption OptTableSpace
{ $$ = cat_str(11, make_str("create"), 2,ドル make_str("table"), 4,ドル make_str("("), 6,ドル make_str(")"), 8,ドル 9,ドル 10,ドル 11ドル); }
| CREATE OptTemp TABLE qualified_name OF qualified_name
- '(' OptTableElementList ')' OptWithOids OnCommitOption OptTableSpace
+ '(' OptTableElementList ')' OptWith OnCommitOption OptTableSpace
{ $$ = cat_str(12, make_str("create"), 2,ドル make_str("table"), 4,ドル make_str("of"), 6,ドル make_str("("), 8,ドル make_str(")"), 10,ドル 11,ドル 12ドル); }
;
@@ -1507,10 +1516,10 @@ ColConstraintElem: NOT NULL_P
{ $$ = make_str("not null"); }
| NULL_P
{ $$ = make_str("null"); }
- | UNIQUE OptConsTableSpace
- { $$ = cat2_str(make_str("unique"), 2ドル); }
- | PRIMARY KEY OptConsTableSpace
- { $$ = cat2_str(make_str("primary key"), 3ドル); }
+ | UNIQUE opt_definition OptConsTableSpace
+ { $$ = cat_str(3, make_str("unique"), 2,ドル 3ドル); }
+ | PRIMARY KEY opt_definition OptConsTableSpace
+ { $$ = cat_str(3, make_str("primary key"), 3,ドル 4ドル); }
| CHECK '(' a_expr ')'
{ $$ = cat_str(3, make_str("check ("), 3,ドル make_str(")")); }
| DEFAULT b_expr
@@ -1536,14 +1545,22 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); }
| INITIALLY IMMEDIATE { $$ = make_str("initially immediate"); }
;
-TableLikeClause: LIKE qualified_name like_including_defaults
+TableLikeClause: LIKE qualified_name TableLikeOptionList
{$$ = cat_str(3, make_str("like"), 2,ドル 3ドル); }
;
-like_including_defaults:
+TableLikeOptionList: TableLikeOptionList TableLikeOption
+ { $$ = cat2_str(1,ドル 2ドル); }
+ | /* EMPTY */ { $$ = EMPTY; }
+ ;
+
+TableLikeOption:
INCLUDING DEFAULTS { $$ = make_str("including defaults"); }
| EXCLUDING DEFAULTS { $$ = make_str("excluding defaults"); }
- | /* EMPTY */ { $$ = EMPTY; }
+ | INCLUDING CONSTRAINTS { $$ = make_str("including constraints"); }
+ | EXCLUDING CONSTRAINTS { $$ = make_str("excluding constraints"); }
+ | INCLUDING INDEXES { $$ = make_str("including indexes"); }
+ | EXCLUDING INDEXES { $$ = make_str("excluding indexes"); }
;
/* ConstraintElem specifies constraint syntax which is not embedded into
@@ -1558,10 +1575,10 @@ TableConstraint: CONSTRAINT name ConstraintElem
ConstraintElem: CHECK '(' a_expr ')'
{ $$ = cat_str(3, make_str("check("), 3,ドル make_str(")")); }
- | UNIQUE '(' columnList ')' OptConsTableSpace
- { $$ = cat_str(4, make_str("unique("), 3,ドル make_str(")"), 5ドル); }
- | PRIMARY KEY '(' columnList ')' OptConsTableSpace
- { $$ = cat_str(4, make_str("primary key("), 4,ドル make_str(")"), 6ドル); }
+ | UNIQUE '(' columnList ')' opt_definition OptConsTableSpace
+ { $$ = cat_str(5, make_str("unique("), 3,ドル make_str(")"), 5,ドル 6ドル); }
+ | PRIMARY KEY '(' columnList ')' opt_definition OptConsTableSpace
+ { $$ = cat_str(5, make_str("primary key("), 4,ドル make_str(")"), 6,ドル 7ドル); }
| FOREIGN KEY '(' columnList ')' REFERENCES qualified_name opt_column_list
key_match key_actions ConstraintAttributeSpec
{ $$ = cat_str(8, make_str("foreign key("), 4,ドル make_str(") references"), 7,ドル 8,ドル 9,ドル 10,ドル 11ドル); }
@@ -1619,9 +1636,10 @@ OptInherit: INHERITS '(' qualified_name_list ')'
{ $$ = EMPTY; }
;
-OptWithOids: WITH OIDS { $$ = make_str("with oids"); }
- | WITHOUT OIDS { $$ = make_str("without oids"); }
- | /*EMPTY*/ { $$ = EMPTY; }
+OptWith: WITH definition { $$ = cat2_str(make_str("with"), 2ドル); }
+ | WITH OIDS { $$ = make_str("with oids"); }
+ | WITHOUT OIDS { $$ = make_str("without oids"); }
+ | /*EMPTY*/ { $$ = EMPTY; }
;
OnCommitOption: ON COMMIT DROP { $$ = make_str("on commit drop"); }
@@ -1643,7 +1661,7 @@ OptConsTableSpace: USING INDEX TABLESPACE name { $$ = cat2_str(make_str("using i
* SELECT ... INTO.
*/
-CreateAsStmt: CREATE OptTemp TABLE qualified_name OptCreateAs OptWithOids OnCommitOption OptTableSpace AS
+CreateAsStmt: CREATE OptTemp TABLE qualified_name OptCreateAs OptWith OnCommitOption OptTableSpace AS
{ FoundInto = 0; }
SelectStmt
{
@@ -1755,6 +1773,8 @@ opt_lancompiler: LANCOMPILER StringConst
DropPLangStmt: DROP opt_procedural LANGUAGE StringConst opt_drop_behavior
{ $$ = cat_str(5, make_str("drop"), 2,ドル make_str("language"), 4,ドル 5ドル); }
+ | DROP opt_procedural LANGUAGE IF_P EXISTS StringConst opt_drop_behavior
+ { $$ = cat_str(5, make_str("drop"), 2,ドル make_str("language if exists"), 6,ドル 7ドル); }
;
opt_procedural: PROCEDURAL { $$ = make_str("prcedural"); }
@@ -1789,6 +1809,8 @@ OptTableSpaceOwner: OWNER name { $$ = cat2_str(make_str("owner"), 2ドル); }
DropTableSpaceStmt: DROP TABLESPACE name
{ $$ = cat2_str(make_str("drop tablespace"), 3ドル); }
+ | DROP TABLESPACE IF_P EXISTS name
+ { $$ = cat2_str(make_str("drop tablespace if exists"), 5ドル); }
;
@@ -1890,6 +1912,8 @@ ConstraintTimeSpec: INITIALLY IMMEDIATE
DropTrigStmt: DROP TRIGGER name ON qualified_name opt_drop_behavior
{ $$ = cat_str(5, make_str("drop trigger"), 3,ドル make_str("on"), 5,ドル 6ドル); }
+ | DROP TRIGGER IF_P EXISTS name ON qualified_name opt_drop_behavior
+ { $$ = cat_str(5, make_str("drop trigger if exists"), 5,ドル make_str("on"), 7,ドル 8ドル); }
;
/*****************************************************************************
@@ -1950,6 +1974,8 @@ def_elem: ColLabel '=' def_arg { $$ = cat_str(3, 1,ドル make_str("="), 3ドル); }
/* Note: any simple identifier will be returned as a type name! */
def_arg: func_type { $$ = 1ドル; }
+ | func_name_keyword { $$ = 1ドル; }
+ | reserved_keyword { $$ = 1ドル; }
| qual_all_Op { $$ = 1ドル; }
| AllConst { $$ = 1ドル; }
;
@@ -2005,6 +2031,8 @@ opt_recheck: RECHECK { $$ = make_str("recheck"); }
DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behavior
{ $$ = cat_str(5,make_str("drop operator class"), 4,ドル make_str("using"), 6,ドル 7ドル); }
+ | DROP OPERATOR CLASS IF_P EXISTS any_name USING access_method opt_drop_behavior
+ { $$ = cat_str(5,make_str("drop operator class if exists"), 6,ドル make_str("using"), 8,ドル 9ドル); }
;
/*****************************************************************************
@@ -2304,8 +2332,8 @@ opt_granted_by: GRANTED BY RoleId { $$ = cat2_str(make_str("granted by"), 3ドル);
*****************************************************************************/
IndexStmt: CREATE index_opt_unique INDEX index_name ON qualified_name
- access_method_clause '(' index_params ')' OptTableSpace where_clause
- { $$ = cat_str(12, make_str("create"), 2,ドル make_str("index"), 4,ドル make_str("on"), 6,ドル 7,ドル make_str("("), 9,ドル make_str(")"), 11,ドル 12ドル); }
+ access_method_clause '(' index_params ')' opt_definition OptTableSpace where_clause
+ { $$ = cat_str(13, make_str("create"), 2,ドル make_str("index"), 4,ドル make_str("on"), 6,ドル 7,ドル make_str("("), 9,ドル make_str(")"), 11,ドル 12,ドル 13ドル); }
;
index_opt_unique: UNIQUE { $$ = make_str("unique"); }
@@ -2464,14 +2492,20 @@ opt_restrict: RESTRICT { $$ = make_str("restrict"); }
RemoveFuncStmt: DROP FUNCTION func_name func_args opt_drop_behavior
{ $$ = cat_str(4, make_str("drop function"), 3,ドル 4,ドル 5ドル); }
+ | DROP FUNCTION IF_P EXISTS func_name func_args opt_drop_behavior
+ { $$ = cat_str(4, make_str("drop function if exists"), 5,ドル 6,ドル 7ドル); }
;
RemoveAggrStmt: DROP AGGREGATE func_name aggr_args opt_drop_behavior
{ $$ = cat_str(4, make_str("drop aggregate"), 3,ドル 4,ドル 5ドル); }
+ | DROP AGGREGATE IF_P EXISTS func_name aggr_args opt_drop_behavior
+ { $$ = cat_str(4, make_str("drop aggregate if exists"), 5,ドル 6,ドル 7ドル); }
;
RemoveOperStmt: DROP OPERATOR all_Op '(' oper_argtypes ')' opt_drop_behavior
{ $$ = cat_str(6, make_str("drop operator"), 3,ドル make_str("("), 5,ドル make_str(")"), 7ドル); }
+ | DROP OPERATOR IF_P EXISTS any_operator '(' oper_argtypes ')' opt_drop_behavior
+ { $$ = cat_str(6, make_str("drop operator if exists"), 5,ドル make_str("("), 7,ドル make_str(")"), 9ドル); }
;
oper_argtypes: Typename
@@ -2504,8 +2538,12 @@ cast_context: AS ASSIGNMENT { $$ = make_str("as assignment"); }
;
-DropCastStmt: DROP CAST '(' Typename AS Typename ')' opt_drop_behavior
- { $$ = cat_str(6, make_str("drop cast ("), 4,ドル make_str("as"), 6,ドル make_str(")"), 8ドル); }
+DropCastStmt: DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_behavior
+ { $$ = cat_str(8, make_str("drop cast"), 3,ドル make_str("("), 5,ドル make_str("as"), 7,ドル make_str(")"), 9ドル); }
+ ;
+
+opt_if_exists: IF_P EXISTS { $$ = make_str("if exists"); }
+ | /* EMPTY */ { $$ = EMPTY; }
;
/*****************************************************************************
@@ -2676,6 +2714,8 @@ opt_instead: INSTEAD { $$ = make_str("instead"); }
DropRuleStmt: DROP RULE name ON qualified_name opt_drop_behavior
{ $$ = cat_str(5, make_str("drop rule"), 3,ドル make_str("on"), 5,ドル 6ドル);}
+ | DROP RULE IF_P EXISTS name ON qualified_name opt_drop_behavior
+ { $$ = cat_str(5, make_str("drop rule if exists"), 5,ドル make_str("on"), 7,ドル 8ドル);}
;
/*****************************************************************************
@@ -3025,7 +3065,7 @@ prep_type_list: Typename { $$ = 1ドル; }
ExecuteStmt: EXECUTE name execute_param_clause
{ $$ = cat_str(3, make_str("execute"), 2,ドル 3ドル); }
| CREATE OptTemp TABLE qualified_name OptCreateAs
- OptWithOids OnCommitOption OptTableSpace AS
+ OptWith OnCommitOption OptTableSpace AS
EXECUTE name execute_param_clause
{ $$ = cat_str(11, make_str("create"), 2,ドル make_str("table"), 4,ドル 5,ドル 6,ドル 7,ドル 8,ドル make_str("as execute"), 11,ドル 12ドル); }
;
@@ -3050,16 +3090,13 @@ InsertStmt: INSERT INTO qualified_name insert_rest
{ $$ = cat_str(3, make_str("insert into"), 3,ドル 4ドル); }
;
-insert_rest: VALUES '(' insert_target_list ')'
- { $$ = cat_str(3, make_str("values("), 3,ドル make_str(")")); }
- | DEFAULT VALUES
- { $$ = make_str("default values"); }
- | SelectStmt
+insert_rest:
+ SelectStmt
{ $$ = 1ドル; }
- | '(' insert_column_list ')' VALUES '(' insert_target_list ')'
- { $$ = cat_str(5, make_str("("), 2,ドル make_str(") values ("), 6,ドル make_str(")")); }
| '(' insert_column_list ')' SelectStmt
{ $$ = cat_str(4, make_str("("), 2,ドル make_str(")"), 4ドル); }
+ | DEFAULT VALUES
+ { $$ = make_str("default values"); }
;
insert_column_list: insert_column_list ',' insert_column_item
@@ -3219,6 +3256,8 @@ simple_select: SELECT opt_distinct target_list
into_clause from_clause where_clause
group_clause having_clause
{ $$ = cat_str(8, make_str("select"), 2,ドル 3,ドル 4,ドル 5,ドル 6,ドル 7,ドル 8ドル); }
+ | values_clause
+ { $$ = 1ドル; }
| select_clause UNION opt_all select_clause
{ $$ = cat_str(4, 1,ドル make_str("union"), 3,ドル 4ドル); }
| select_clause INTERSECT opt_all select_clause
@@ -3370,6 +3409,20 @@ locked_rels_list:
| /* EMPTY */ { $$ = EMPTY; }
;
+values_clause: VALUES '(' values_list ')'
+ { $$ = cat_str(3, make_str("values("), 3,ドル make_str(")")); }
+ | values_clause ',' '(' values_list ')'
+ { $$ = cat_str(4, 1,ドル make_str(", ("), 4,ドル make_str(")")); }
+ ;
+
+values_list: values_item { $$ = 1ドル; }
+ | values_list ',' values_item { $$ = cat_str(3, 1,ドル make_str(","), 3ドル); }
+ ;
+
+values_item: a_expr { $$ = 1ドル; }
+ | DEFAULT { $$ = make_str("DEFAULT"); }
+ ;
+
/*****************************************************************************
*
* clauses common to all Optimizable Stmts:
@@ -4346,17 +4399,6 @@ update_target_el: ColId opt_indirection '=' a_expr
{ $$ = cat_str(3, 1,ドル 2,ドル make_str("= default")); }
;
-insert_target_list: insert_target_list ',' insert_target_el
- { $$ = cat_str(3, 1,ドル make_str(","), 3ドル); }
- | insert_target_el
- { $$ = 1ドル; }
- ;
-
-insert_target_el: a_expr { $$ = 1ドル; }
- | DEFAULT { $$ = make_str("default"); }
- ;
-
-
/*****************************************************************************
*
* Names and constants
@@ -6009,24 +6051,25 @@ symbol: ColLabel { $$ = 1ドル; }
* is chosen in part to make keywords acceptable as names wherever possible.
*/
-ECPGColId:ident { $$ = 1ドル; }
+ECPGColId:ident { $$ = 1ドル; }
| ECPGunreserved_interval { $$ = 1ドル; }
| ECPGunreserved_con { $$ = 1ドル; }
- | col_name_keyword { $$ = 1ドル; }
- | ECPGKeywords { $$ = 1ドル; }
- | ECPGCKeywords { $$ = 1ドル; }
- | CHAR_P { $$ = make_str("char"); }
+ | col_name_keyword { $$ = 1ドル; }
+ | ECPGKeywords { $$ = 1ドル; }
+ | ECPGCKeywords { $$ = 1ドル; }
+ | CHAR_P { $$ = make_str("char"); }
+ | VALUES { $$ = make_str("values"); }
;
/* Column identifier --- names that can be column, table, etc names.
*/
-ColId: ident { $$ = 1ドル; }
+ColId: ident { $$ = 1ドル; }
| unreserved_keyword { $$ = 1ドル; }
- | col_name_keyword { $$ = 1ドル; }
- | ECPGKeywords { $$ = 1ドル; }
- | ECPGCKeywords { $$ = 1ドル; }
- | CHAR_P { $$ = make_str("char"); }
+ | col_name_keyword { $$ = 1ドル; }
+ | ECPGKeywords { $$ = 1ドル; }
+ | ECPGCKeywords { $$ = 1ドル; }
+ | CHAR_P { $$ = make_str("char"); }
+ | VALUES { $$ = make_str("values"); }
;
-
/* Type identifier --- names that can be type names.
*/
type_name: ident { $$ = 1ドル; }
@@ -6060,15 +6103,15 @@ ColLabel: ECPGColLabel { $$ = 1ドル; }
;
ECPGColLabelCommon: ident { $$ = 1ドル; }
- | col_name_keyword { $$ = 1ドル; }
+ | col_name_keyword { $$ = 1ドル; }
| func_name_keyword { $$ = 1ドル; }
| ECPGKeywords_vanames { $$ = 1ドル; }
;
ECPGColLabel: ECPGColLabelCommon { $$ = 1ドル; }
- | reserved_keyword { $$ = 1ドル; }
- | ECPGunreserved { $$ = 1ドル; }
- | ECPGKeywords_rest { $$ = 1ドル; }
+ | reserved_keyword { $$ = 1ドル; }
+ | ECPGunreserved { $$ = 1ドル; }
+ | ECPGKeywords_rest { $$ = 1ドル; }
;
ECPGCKeywords: S_AUTO { $$ = make_str("auto"); }
@@ -6191,6 +6234,7 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| INCLUDING { $$ = make_str("including"); }
| INCREMENT { $$ = make_str("increment"); }
| INDEX { $$ = make_str("index"); }
+ | INDEXES { $$ = make_str("indexes"); }
| INHERIT { $$ = make_str("inherit"); }
| INHERITS { $$ = make_str("inherits"); }
| INSENSITIVE { $$ = make_str("insensitive"); }
@@ -6289,7 +6333,6 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| TEMP { $$ = make_str("temp"); }
| TEMPLATE { $$ = make_str("template"); }
| TEMPORARY { $$ = make_str("temporary"); }
- | TOAST { $$ = make_str("toast"); }
| TRANSACTION { $$ = make_str("transaction"); }
| TRIGGER { $$ = make_str("trigger"); }
| TRUNCATE { $$ = make_str("truncate"); }
@@ -6303,7 +6346,6 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| UPDATE { $$ = make_str("update"); }
| VACUUM { $$ = make_str("vacuum"); }
| VALID { $$ = make_str("valid"); }
- | VALUES { $$ = make_str("values"); }
| VARYING { $$ = make_str("varying"); }
| VIEW { $$ = make_str("view"); }
| WITH { $$ = make_str("with"); }
@@ -6364,6 +6406,8 @@ col_name_keyword:
| TIMESTAMP { $$ = make_str("timestamp"); }
| TREAT { $$ = make_str("treat"); }
| TRIM { $$ = make_str("trim"); }
+ /* VALUES creates a shift/reduce problem if listed here
+ | VALUES { $$ = make_str("values"); } */
| VARCHAR { $$ = make_str("varchar"); }
;
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index c88f43896c107958304b2138c9fb2858c0aad889..2e74972dab94712259e696e04daa64b23ee5ca1b 100644 (file)
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -1,46 +1,50 @@
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.53 2006年02月08日 09:10:05 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.54 2006年08月02日 13:43:23 meskes Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
-override CPPFLAGS := -I$(srcdir)/../include -I$(libpq_srcdir) $(CPPFLAGS)
-override CFLAGS += $(PTHREAD_CFLAGS)
+# port number for temp-installation test postmaster
+TEMP_PORT = 5$(DEF_PGPORT)
-ECPG = ../preproc/ecpg -I$(srcdir)/../include
+# default encoding
+MULTIBYTE = SQL_ASCII
-TESTS = test1 test2 test3 test4 test5 perftest dyntest dyntest2 test_notice \
- test_code100 test_init testdynalloc num_test dt_test test_informix \
- test_informix2 test_desc test_func
-ifeq ($(enable_thread_safety), yes)
-TESTS += test_thread test_thread_implicit
+# locale
+NOLOCALE :=
+ifdef NO_LOCALE
+NOLOCALE += --no-locale
endif
-all: $(TESTS)
+all clean install installdirs uninstall dep depend distprep:
+ $(MAKE) -C connect $@
+ $(MAKE) -C sql $@
+ $(MAKE) -C pgtypeslib $@
+ $(MAKE) -C errors $@
+ $(MAKE) -C compat_informix $@
+ $(MAKE) -C complex $@
+ $(MAKE) -C thread $@
+# for some reason I couldn't figure out, ifeq($@,clean) ... does not work
+ if [ $@ = clean ]; then rm -f results/*.stdout results/*.stderr results/*.c; rm -rf tmp_check/; rm -f log/*.log; rm -f pg_regress.inc.sh regression.diff; fi
+
+all: pg_regress.sh
+
+pg_regress.sh: pg_regress.inc.sh
+
+pg_regress.inc.sh: pg_regress.inc.sh.in $(top_builddir)/src/Makefile.global
+ sed -e 's,@bindir@,$(bindir),g' \
+ -e 's,@libdir@,$(libdir),g' \
+ -e 's,@pkglibdir@,$(pkglibdir),g' \
+ -e 's,@datadir@,$(datadir),g' \
+ -e 's/@VERSION@/$(VERSION)/g' \
+ -e 's/@host_tuple@/$(host_tuple)/g' \
+ -e 's,@GMAKE@,$(MAKE),g' \
+ -e 's/@enable_shared@/$(enable_shared)/g' \
+ -e 's/@GCC@/$(GCC)/g' \
+ $< >$@
+
+test: all pg_regress.inc.sh
+ sh ./pg_regress.sh --dbname=regress1 --debug --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --listen-on-tcp --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
+
+check: all test
-%: %.o
- $(CC) $(CFLAGS) $(LDFLAGS) -L../ecpglib -L ../pgtypeslib -L../../libpq $^ $(LIBS) -lpgtypes -lecpg -lpq $(PTHREAD_LIBS) -o $@
-
-test_informix: test_informix.o
- $(CC) $(CFLAGS) $(LDFLAGS) -L../compatlib -L../ecpglib -L ../pgtypeslib -L../../libpq $^ $(LIBS) -lpgtypes -lecpg -lecpg_compat -lpq $(PTHREAD_LIBS) -o $@
-
-test_informix2: test_informix2.o
- $(CC) $(CFLAGS) $(LDFLAGS) -L../compatlib -L../ecpglib -L ../pgtypeslib -L../../libpq $^ $(LIBS) -lpgtypes -lecpg -lecpg_compat -lpq $(PTHREAD_LIBS) -o $@
-
-test4: test4.o
- $(CC) $(CFLAGS) $(LDFLAGS) -L../ecpglib -L ../pgtypeslib -L../../libpq $^ $(LIBS) -lpgtypes -lecpg -lpq $(PTHREAD_LIBS) -o $@
-
-%.c: %.pgc
- $(ECPG) -o $@ -I$(srcdir) $<
-
-test_informix.c: test_informix.pgc
- $(ECPG) -o $@ -C INFORMIX -r no_indicator $<
-
-test_informix2.c: test_informix2.pgc
- $(ECPG) -o $@ -C INFORMIX $<
-
-test4.c: test4.pgc
- $(ECPG) -o $@ -c $<
-
-clean:
- rm -f $(TESTS) $(TESTS:%=%.o) $(TESTS:%=%.c) log
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /