Skip to content

Commit 276b3bb

Browse files
author
Michael Meskes
committed
Synced parser.
Fixed ecpglib trying to read one character after end-of-string. Fixed port number setting in regression suite.
1 parent 1096400 commit 276b3bb

File tree

4 files changed

+62
-71
lines changed

4 files changed

+62
-71
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,5 +2136,11 @@ Su 3. Sep 14:21:29 CEST 2006
21362136

21372137
- Synced parser.
21382138
- Added another regression test and fixed tcp test.
2139+
2140+
Tu 5. Sep 11:49:08 CEST 2006
2141+
2142+
- Synced parser.
2143+
- Fixed ecpglib trying to read one character after end-of-string.
2144+
- Fixed port number setting in regression suite.
21392145
- Set ecpg library version to 5.2.
21402146
- Set ecpg version to 4.2.1.

src/interfaces/ecpg/ecpglib/prepare.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.16 2006/02/04 20:54:42 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.17 2006/09/05 10:00:52 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -53,6 +53,8 @@ replace_variables(char *text)
5353
*ptr = '?';
5454
for (++ptr; *ptr && isvarchar(*ptr); ptr++)
5555
*ptr = ' ';
56+
if (*ptr == '\0') /* we reached the end */
57+
ptr--; /* since we will ptr++ in the top level for loop */
5658
}
5759
}
5860
}

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 51 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.336 2006/09/03 19:30:43 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.337 2006/09/05 10:00:52 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -478,8 +478,8 @@ add_additional_variables(char *name, bool insert)
478478
%type <str> ColConstraint ColConstraintElem drop_type Bconst Iresult
479479
%type <str> TableConstraint OptTableElementList Xconst opt_transaction
480480
%type <str> ConstraintElem key_actions ColQualList type_name
481-
%type <str> target_list target_el update_target_list alias_clause
482-
%type <str> update_target_el qualified_name database_name alter_using
481+
%type <str> target_list target_el alias_clause
482+
%type <str> qualified_name database_name alter_using
483483
%type <str> access_method attr_name index_name name func_name
484484
%type <str> file_name AexprConst c_expr ConstTypename var_list
485485
%type <str> a_expr b_expr TruncateStmt CommentStmt OnCommitOption opt_by
@@ -545,7 +545,7 @@ add_additional_variables(char *name, bool insert)
545545
%type <str> OptSchemaName OptSchemaEltList schema_stmt opt_drop_behavior
546546
%type <str> handler_name any_name_list any_name opt_as insert_column_list
547547
%type <str> columnref function_name values_clause AllConstVar
548-
%type <str> values_list insert_column_item DropRuleStmt values_item
548+
%type <str> insert_column_item DropRuleStmt ctext_expr
549549
%type <str> createfunc_opt_item set_rest var_list_or_default alter_rel_cmd
550550
%type <str> CreateFunctionStmt createfunc_opt_list func_table
551551
%type <str> DropUserStmt copy_from copy_opt_list copy_opt_item
@@ -577,7 +577,7 @@ add_additional_variables(char *name, bool insert)
577577
%type <str> reserved_keyword unreserved_keyword ecpg_interval opt_ecpg_using
578578
%type <str> col_name_keyword func_name_keyword precision opt_scale
579579
%type <str> ECPGTypeName using_list ECPGColLabelCommon UsingConst
580-
%type <str> using_descriptor into_descriptor
580+
%type <str> using_descriptor into_descriptor
581581
%type <str> prepared_name struct_union_type_with_symbol OptConsTableSpace
582582
%type <str> ECPGunreserved ECPGunreserved_interval cvariable opt_bit_field
583583
%type <str> AlterOwnerStmt OptTableSpaceOwner CreateTableSpaceStmt
@@ -589,8 +589,8 @@ add_additional_variables(char *name, bool insert)
589589
%type <str> locked_rels_list opt_granted_by RevokeRoleStmt alterdb_opt_item using_clause
590590
%type <str> GrantRoleStmt opt_asymmetric aggr_args aggr_args_list old_aggr_definition
591591
%type <str> old_aggr_elem for_locking_items TableLikeOptionList TableLikeOption
592-
%type <str> update_target_lists_list set_opt update_target_lists_el update_col_list
593-
%type <str> update_value_list update_col_list_el
592+
%type <str> set_target_list set_clause_list set_clause multiple_set_clause
593+
%type <str> ctext_expr_list ctext_row single_set_clause set_target
594594

595595
%type <struct_union> s_struct_union_symbol
596596

@@ -3176,16 +3176,35 @@ opt_nowait: NOWAIT { $$ = make_str("nowait"); }
31763176
*****************************************************************************/
31773177

31783178
UpdateStmt: UPDATE relation_expr_opt_alias
3179-
SET set_opt
3179+
SET set_clause_list
31803180
from_clause
31813181
where_clause
31823182
returning_clause
31833183
{$$ = cat_str(7, make_str("update"), $2, make_str("set"), $4, $5, $6, $7); }
31843184
;
31853185

3186-
set_opt:
3187-
update_target_list { $$ = $1; }
3188-
| update_target_lists_list { $$ = $1; }
3186+
set_clause_list:
3187+
set_clause { $$ = $1; }
3188+
| set_clause_list ',' set_clause { $$ = cat_str(3, $1, make_str(","), $3); }
3189+
;
3190+
3191+
set_clause:
3192+
single_set_clause { $$ = $1; }
3193+
| multiple_set_clause { $$ = $1; }
3194+
;
3195+
3196+
single_set_clause:
3197+
set_target '=' ctext_expr { $$ = cat_str(3, $1, make_str("="), $3); };
3198+
3199+
multiple_set_clause:
3200+
'(' set_target_list ')' '=' ctext_row { $$ = cat_str(4, make_str("("), $2, make_str(")="), $5); };
3201+
3202+
set_target:
3203+
ColId opt_indirection { $$ = cat2_str($1, $2); };
3204+
3205+
set_target_list:
3206+
set_target { $$ = $1; }
3207+
| set_target_list ',' set_target { $$ = cat_str(3, $1, make_str(","), $3); }
31893208
;
31903209

31913210
/*****************************************************************************
@@ -3433,47 +3452,10 @@ locked_rels_list:
34333452
| /* EMPTY */ { $$ = EMPTY; }
34343453
;
34353454

3436-
values_clause: VALUES '(' values_list ')'
3437-
{ $$ = cat_str(3, make_str("values("), $3, make_str(")")); }
3438-
| values_clause ',' '(' values_list ')'
3439-
{ $$ = cat_str(4, $1, make_str(", ("), $4, make_str(")")); }
3440-
;
3441-
3442-
values_list: values_item { $$ = $1; }
3443-
| values_list ',' values_item { $$ = cat_str(3, $1, make_str(","), $3); }
3444-
;
3445-
3446-
values_item: a_expr { $$ = $1; }
3447-
| DEFAULT { $$ = make_str("DEFAULT"); }
3448-
;
3449-
3450-
update_target_lists_list:
3451-
update_target_lists_el { $$ = $1; }
3452-
| update_target_lists_list ',' update_target_lists_el { $$ = cat_str(3, $1, make_str(","), $3); }
3453-
;
3454-
3455-
update_target_lists_el:
3456-
'(' update_col_list ')' '=' '(' update_value_list ')'
3457-
{
3458-
$$ = cat_str(5, make_str("("), $2, make_str(")=("), $6, make_str(")"));
3459-
}
3460-
;
3461-
3462-
update_col_list:
3463-
update_col_list_el { $$ = $1; }
3464-
| update_col_list ',' update_col_list_el { $$ = cat_str(3, $1, make_str(","), $3); }
3465-
;
3466-
3467-
update_col_list_el:
3468-
ColId opt_indirection
3469-
{
3470-
$$ = cat2_str($1, $2);
3471-
}
3472-
;
3473-
3474-
update_value_list:
3475-
values_item { $$ = $1; }
3476-
| update_value_list ',' values_item { $$ = cat_str(3, $1, make_str(","), $3); }
3455+
values_clause: VALUES ctext_row
3456+
{ $$ = cat2_str(make_str("values"), $2); }
3457+
| values_clause ',' ctext_row
3458+
{ $$ = cat_str(3, $1, make_str(","), $3); }
34773459
;
34783460

34793461
/*****************************************************************************
@@ -4356,9 +4338,21 @@ opt_asymmetric: ASYMMETRIC { $$ = make_str("asymmetric"); }
43564338
| /*EMPTY*/ { $$ = EMPTY; }
43574339
;
43584340

4341+
ctext_expr:
4342+
a_expr { $$ = $1; }
4343+
| DEFAULT { $$ = make_str("default"); }
4344+
;
4345+
4346+
ctext_expr_list:
4347+
ctext_expr { $$ = $1; }
4348+
| ctext_expr_list ',' ctext_expr { $$ = cat_str(3, $1, make_str(","), $3); }
4349+
;
4350+
4351+
ctext_row: '(' ctext_expr_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")"));};
4352+
43594353
/*****************************************************************************
43604354
*
4361-
* target lists for SELECT, UPDATE, INSERT
4355+
* target lists for SELECT
43624356
*
43634357
*****************************************************************************/
43644358

@@ -4377,11 +4371,8 @@ target_el: a_expr AS ColLabel
43774371
{ $$ = make_str("*"); }
43784372
;
43794373

4380-
/* Target list as found in UPDATE table SET ... */
4381-
update_target_list: update_target_list ',' update_target_el
4382-
{ $$ = cat_str(3, $1, make_str(","),$3); }
4383-
/* INFORMIX workaround, no longer needed
4384-
| '(' inf_col_list ')' '=' '(' inf_val_list ')'
4374+
/* INFORMIX workaround, no longer needed
4375+
update_target_list: '(' inf_col_list ')' '=' '(' inf_val_list ')'
43854376
{
43864377
struct inf_compat_col *ptrc;
43874378
struct inf_compat_val *ptrv;
@@ -4404,12 +4395,10 @@ update_target_list: update_target_list ',' update_target_el
44044395
vals = cat_str( 3, vals, ptrv->val, make_str(")") );
44054396
}
44064397
$$ = cat_str( 3, cols, make_str("="), vals );
4407-
} */
4408-
| update_target_el
4409-
{ $$ = $1; }
4398+
}
44104399
;
44114400
4412-
/* inf_col_list: ColId opt_indirection
4401+
inf_col_list: ColId opt_indirection
44134402
{
44144403
struct inf_compat_col *ptr = mm_alloc(sizeof(struct inf_compat_col));
44154404
@@ -4448,12 +4437,6 @@ inf_val_list: a_expr
44484437
;
44494438
*/
44504439

4451-
update_target_el: ColId opt_indirection '=' a_expr
4452-
{ $$ = cat_str(4, $1, $2, make_str("="), $4); }
4453-
| ColId opt_indirection '=' DEFAULT
4454-
{ $$ = cat_str(3, $1, $2, make_str("= default")); }
4455-
;
4456-
44574440
/*****************************************************************************
44584441
*
44594442
* Names and constants

src/interfaces/ecpg/test/pg_regress.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.10 2006/09/04 19:36:21 momjian Exp $
2+
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.11 2006/09/05 10:00:53 meskes Exp $
33

44
me=`basename $0`
55

@@ -644,7 +644,7 @@ trap 'sig_trap $?' 1 2 13 15
644644
if [ x"$temp_install" != x"" ]
645645
then
646646
do_temp_install
647-
PGPORT=$temp_port; export PGPORT
647+
#PGPORT=$temp_port; export PGPORT
648648
else # not temp-install
649649
dont_temp_install
650650
fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy