]> granicus.if.org Git - postgresql/commitdiff
*** empty log message ***
authorMichael Meskes <meskes@postgresql.org>
Mon, 19 Jul 1999 12:37:48 +0000 (12:37 +0000)
committerMichael Meskes <meskes@postgresql.org>
Mon, 19 Jul 1999 12:37:48 +0000 (12:37 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/TODO
src/interfaces/ecpg/lib/Makefile.in
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/preproc.y

index 0d37df4a7a1a7039ad6298ae18fd0ec22e56726d..78e94f3401b3fb03eab044643664ec2bfb7412af 100644 (file)
@@ -609,3 +609,11 @@ Fri Jun 25 07:17:10 CEST 1999
        - Changed error message in ecpglib.c to list correct database name.
        - Set library version to 3.0.0
        - Set ecpg version to 2.6.0
+
+Mon Jul 19 07:53:20 CEST 1999
+
+       - Synced preproc.y with gram.y.
+       - Synced pgc.l with scan.l.
+       - Fixed quoting bug in ecpglib.c
+       - Set ecpg version to 2.6.1
+       - Set library version to 3.0.1
index f6e425b958a5800217acee99d8568c38633e2316..114500850c66f3a19f07042016fbe9d17a1eee56 100644 (file)
@@ -13,8 +13,6 @@ support for dynamic SQL with unknown number of variables with DESCRIPTORS
 
 The line numbering is not exact.
 
-Inside an SQL statement quoting only works with SQL92 style double quotes: ''. 
-
 Missing statements:
  - exec sql allocate
  - exec sql deallocate
index c7b4c80e06e57093483ff5b65dbe787888c1600b..6f9f3dce8b9e62c22e22a101cad6f5a55ea68c9f 100644 (file)
@@ -6,13 +6,13 @@
 # Copyright (c) 1994, Regents of the University of California
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.44 1999/06/30 23:57:23 tgl Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.45 1999/07/19 12:37:46 meskes Exp $
 #
 #-------------------------------------------------------------------------
 
 NAME= ecpg
 SO_MAJOR_VERSION= 3
-SO_MINOR_VERSION= 0.0
+SO_MINOR_VERSION= 0.1
 
 SRCDIR= @top_srcdir@
 include $(SRCDIR)/Makefile.global
index a51b1ce69c34686ef6808720c824e5b560a25034..2f59c78a67e565b6f893e88d4be85221af5f71a3 100644 (file)
@@ -209,8 +209,8 @@ add_mem(void *ptr, int lineno)
        auto_allocs = am;
 }
 
-/* This function returns a newly malloced string that has the ' and \
-   in the argument quoted with \.
+/* This function returns a newly malloced string that has the  \
+   in the argument quoted with \ and the ' quote with ' as SQL92 says.
  */
 static
 char *
@@ -228,8 +228,11 @@ quote_postgres(char *arg, int lineno)
                switch (arg[i])
                {
                        case '\'':
+                               res[ri++] = '\'';
+                               break;
                        case '\\':
                                res[ri++] = '\\';
+                               break;
                        default:
                                ;
                }
index 26e1cf3f9024ae44c1ac23b2996eb4d4e6890e4e..359b42b3fa5e0d7b4b96686394dc2aeb7b2291c5 100644 (file)
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
 
 MAJOR_VERSION=2
 MINOR_VERSION=6
-PATCHLEVEL=0
+PATCHLEVEL=1
 
 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
        -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
index 493d6e3c70607afe80f2b5180bc0bde49357e39c..f583a60294b8ac834814b8f5863fd904b28aff59 100644 (file)
@@ -132,7 +132,7 @@ identifier          {letter}{letter_or_digit}*
 
 typecast               "::"
 
-self                   [,()\[\].;$\:\+\-\*\/\%\<\>\=\|]
+self                   [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
 op_and_self            [\~\!\@\#\^\&\|\\1c?\$\:\+\-\*\/\%\<\>\=]
 operator               {op_and_self}+
 
index 04b27c5f1fefe8967b2c23a696b14916b0686c98..02caacf4cf47524754c8d73dc235a8cb9e5afc5b 100644 (file)
@@ -754,6 +754,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
 %nonassoc      IS
 %left          '+' '-'
 %left          '*' '/' '%'
+%left          '^'
 %left          '|'                             /* this is the relation union op, not logical or */
 /* Unary Operators */
 %right         ':'
@@ -772,15 +773,15 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
 %type  <str>    ColConstraint ColConstraintElem default_list NumericOnly FloatOnly
 %type  <str>    OptTableElementList OptTableElement TableConstraint
 %type  <str>    ConstraintElem key_actions constraint_list ColPrimaryKey
-%type  <str>    res_target_list res_target_el res_target_list2
-%type  <str>    res_target_el2 opt_id relation_name database_name
+%type  <str>    target_list target_el update_target_list
+%type  <str>    update_target_el opt_id relation_name database_name
 %type  <str>    access_method attr_name class index_name name func_name
 %type  <str>    file_name AexprConst ParamNo TypeId
 %type  <str>   in_expr_nodes not_in_expr_nodes a_expr b_expr
 %type  <str>   opt_indirection expr_list extract_list extract_arg
-%type  <str>   position_list position_expr substr_list substr_from
+%type  <str>   position_list substr_list substr_from
 %type  <str>   trim_list in_expr substr_for not_in_expr attr attrs
-%type  <str>   Typename Array Generic Numeric generic opt_float opt_numeric
+%type  <str>   Typename SimpleTypename Generic Numeric generic opt_float opt_numeric
 %type  <str>   opt_decimal Character character opt_varying opt_charset
 %type  <str>   opt_collate Datetime datetime opt_timezone opt_interval
 %type  <str>   numeric a_expr_or_null row_expr row_descriptor row_list
@@ -848,8 +849,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
 
 %type  <action> action
 
-%type  <index> opt_array_bounds nest_array_bounds opt_type_array_bounds
-%type  <index>  nest_type_array_bounds
+%type  <index> opt_array_bounds opt_type_array_bounds
 
 %type  <ival>  Iresult
 %%
@@ -1237,6 +1237,9 @@ ClosePortalStmt:  CLOSE opt_id
                                }
                ;
 
+opt_id:  ColId         { $$ = $1; }
+       | /*EMPTY*/     { $$ = NULL; }
+       ;
 
 /*****************************************************************************
  *
@@ -1442,6 +1445,8 @@ default_expr:  AexprConst
                                {       $$ = cat3_str($1, make1_str("%"), $3); }
                        | default_expr '*' default_expr
                                {       $$ = cat3_str($1, make1_str("*"), $3); }
+                       | default_expr '^' default_expr
+                               {       $$ = cat3_str($1, make1_str("^"), $3); }
                        | default_expr '=' default_expr
                                {       yyerror("boolean expressions not supported in DEFAULT"); }
                        | default_expr '<' default_expr
@@ -1564,6 +1569,8 @@ constraint_expr:  AexprConst
                                {       $$ = cat3_str($1, make1_str("%"), $3); }
                        | constraint_expr '*' constraint_expr
                                {       $$ = cat3_str($1, make1_str("*"), $3); }
+                       | constraint_expr '^' constraint_expr
+                               {       $$ = cat3_str($1, make1_str("^"), $3); }
                        | constraint_expr '=' constraint_expr
                                {       $$ = cat3_str($1, make1_str("="), $3); }
                        | constraint_expr '<' constraint_expr
@@ -2631,7 +2638,7 @@ InsertStmt:  INSERT INTO relation_name insert_rest
                                }
                ;
 
-insert_rest:  VALUES '(' res_target_list2 ')'
+insert_rest:  VALUES '(' target_list ')'
                                {
                                        $$ = make3_str(make1_str("values("), $3, make1_str(")"));
                                }
@@ -2643,7 +2650,7 @@ insert_rest:  VALUES '(' res_target_list2 ')'
                                {
                                        $$ = $1;
                                }
-               | '(' columnList ')' VALUES '(' res_target_list2 ')'
+               | '(' columnList ')' VALUES '(' target_list ')'
                                {
                                        $$ = make5_str(make1_str("("), $2, make1_str(") values ("), $6, make1_str(")"));
                                }
@@ -2713,7 +2720,7 @@ opt_lmode:      SHARE                           { $$ = make1_str("share"); }
  *****************************************************************************/
 
 UpdateStmt:  UPDATE relation_name
-                         SET res_target_list
+                         SET update_target_list
                          from_clause
                          where_clause
                                {
@@ -2822,7 +2829,7 @@ select_clause: '(' select_clause ')'
                        }
                ;
 
-SubSelect:     SELECT opt_unique res_target_list2
+SubSelect:     SELECT opt_unique target_list
                          result from_clause where_clause
                          group_clause having_clause
                                {
@@ -3112,13 +3119,13 @@ relation_expr:  relation_name
                                        $$ = cat2_str($1, make1_str("*"));
                                }
 
-opt_array_bounds:  '[' ']' nest_array_bounds
+opt_array_bounds:  '[' ']' opt_array_bounds
                        {
                             $$.index1 = 0;
                             $$.index2 = $3.index1;
                             $$.str = cat2_str(make1_str("[]"), $3.str);
                         }
-               | '[' Iresult ']' nest_array_bounds
+               | '[' Iresult ']' opt_array_bounds
                        {
                            char *txt = mm_alloc(20L);
 
@@ -3135,29 +3142,6 @@ opt_array_bounds:  '[' ']' nest_array_bounds
                         }
                ;
 
-nest_array_bounds:     '[' ']' nest_array_bounds
-                        {
-                            $$.index1 = 0;
-                            $$.index2 = $3.index1;
-                            $$.str = cat2_str(make1_str("[]"), $3.str);
-                        }
-               | '[' Iresult ']' nest_array_bounds
-                       {
-                           char *txt = mm_alloc(20L);
-
-                           sprintf (txt, "%d", $2);
-                            $$.index1 = $2;
-                            $$.index2 = $4.index1;
-                            $$.str = cat4_str(make1_str("["), txt, make1_str("]"), $4.str);
-                        }
-               | /* EMPTY */
-                       {
-                            $$.index1 = -1;
-                            $$.index2 = -1;
-                            $$.str= make1_str("");
-                        }
-                ;
-
 Iresult:       Iconst                  { $$ = atol($1); }
        |       '(' Iresult ')'         { $$ = $2; }
        |       Iresult '+' Iresult     { $$ = $1 + $3; }
@@ -3178,17 +3162,17 @@ Iresult:        Iconst                  { $$ = atol($1); }
  *
  *****************************************************************************/
 
-Typename:  Array opt_array_bounds
+Typename:  SimpleTypename opt_array_bounds
                                {
                                        $$ = cat2_str($1, $2.str);
                                }
-               | SETOF Array
+               | SETOF SimpleTypename
                                {
                                        $$ = cat2_str(make1_str("setof"), $2);
                                }
                ;
 
-Array:  Generic                        { $$ = $1; }
+SimpleTypename:  Generic       { $$ = $1; }
                | Datetime      { $$ = $1; }
                | Numeric       { $$ = $1; }
                | Character     { $$ = $1; }
@@ -3349,7 +3333,7 @@ Character:  character '(' Iconst ')'
                                                yyerror(errortext);
                                        }
                                        else if (atol($3) > MaxAttrSize) {
-                                               sprintf(errortext, "length for type '%s' cannot exceed %ld",$1,(long) MaxAttrSize);
+                                               sprintf(errortext, "length for type '%s' cannot exceed %ld", $1, MaxAttrSize);
                                                yyerror(errortext);
                                        }
 
@@ -3514,24 +3498,28 @@ row_list:  row_list ',' a_expr
  *  if surrounded by parens.
  */
 
-a_expr:  attr opt_indirection
+a_expr:  attr
                                {
-                                       $$ = cat2_str($1, $2);
+                                       $$ = $1;
                                }
                | row_expr
                                {       $$ = $1;  }
                | AexprConst
                                {       $$ = $1;  }
-               | ColId
+               | ColId opt_indirection
                                {
-                                       $$ = $1;
+                                       $$ = cat2_str($1, $2);
                                }
                | '-' a_expr %prec UMINUS
                                {       $$ = cat2_str(make1_str("-"), $2); }
                | '%' a_expr
                                {       $$ = cat2_str(make1_str("%"), $2); }
+               | '^' a_expr
+                               {       $$ = cat2_str(make1_str("^"), $2); }
                | a_expr '%'
                                {       $$ = cat2_str($1, make1_str("%")); }
+               | a_expr '^'
+                               {       $$ = cat2_str($1, make1_str("^")); }
                | a_expr '+' a_expr
                                {       $$ = cat3_str($1, make1_str("+"), $3); }
                | a_expr '-' a_expr
@@ -3542,6 +3530,8 @@ a_expr:  attr opt_indirection
                                {       $$ = cat3_str($1, make1_str("%"), $3); }
                | a_expr '*' a_expr
                                {       $$ = cat3_str($1, make1_str("*"), $3); }
+               | a_expr '^' a_expr
+                               {       $$ = cat3_str($1, make1_str("^"), $3); }
                | a_expr '<' a_expr
                                {       $$ = cat3_str($1, make1_str("<"), $3); }
                | a_expr '>' a_expr
@@ -3826,22 +3816,26 @@ a_expr:  attr opt_indirection
  *  defined by a_expr. b_expr is used in BETWEEN clauses
  *  to eliminate parser ambiguities stemming from the AND keyword.
  */
-b_expr:  attr opt_indirection
+b_expr:  attr
                                {
-                                       $$ = cat2_str($1, $2);
+                                       $$ = $1
                                }
                | AexprConst
                                {       $$ = $1;  }
-               | ColId
+               | ColId opt_indirection
                                {
-                                       $$ = $1;
+                                       $$ = cat2_str($1, $2);
                                }
                | '-' b_expr %prec UMINUS
                                {       $$ = cat2_str(make1_str("-"), $2); }
                | '%' b_expr
                                {       $$ = cat2_str(make1_str("%"), $2); }
+               | '^' b_expr
+                               {       $$ = cat2_str(make1_str("^"), $2); }
                | b_expr '%'
                                {       $$ = cat2_str($1, make1_str("%")); }
+               | b_expr '^'
+                               {       $$ = cat2_str($1, make1_str("^")); }
                | b_expr '+' b_expr
                                {       $$ = cat3_str($1, make1_str("+"), $3); }
                | b_expr '-' b_expr
@@ -3852,6 +3846,8 @@ b_expr:  attr opt_indirection
                                {       $$ = cat3_str($1, make1_str("%"), $3); }
                | b_expr '*' b_expr
                                {       $$ = cat3_str($1, make1_str("*"), $3); }
+               | b_expr '^' b_expr
+                               {       $$ = cat3_str($1, make1_str("^"), $3); }
 /* not possible in embedded sql                | ':' b_expr
                                {       $$ = cat2_str(make1_str(":"), $2); }
 */
@@ -3979,87 +3975,13 @@ extract_arg:  datetime          { $$ = $1; }
        | TIMEZONE_MINUTE       { $$ = make1_str("timezone_minute"); }  
                ;
 
-position_list:  position_expr IN position_expr
+/* position_list uses b_expr not a_expr to avoid conflict with general IN */
+position_list:  b_expr IN b_expr
                                {       $$ = cat3_str($1, make1_str("in"), $3); }
                | /* EMPTY */
                                {       $$ = make1_str(""); }
                ;
 
-position_expr:  attr opt_indirection
-                               {
-                                       $$ = cat2_str($1, $2);
-                               }
-               | AexprConst
-                               {       $$ = $1;  }
-               | '-' position_expr %prec UMINUS
-                               {       $$ = cat2_str(make1_str("-"), $2); }
-               | position_expr '+' position_expr
-                               {       $$ = cat3_str($1, make1_str("+"), $3); }
-               | position_expr '-' position_expr
-                               {       $$ = cat3_str($1, make1_str("-"), $3); }
-               | position_expr '/' position_expr
-                               {       $$ = cat3_str($1, make1_str("/"), $3); }
-               | position_expr '%' position_expr
-                               {       $$ = cat3_str($1, make1_str("%"), $3); }
-               | position_expr '*' position_expr
-                               {       $$ = cat3_str($1, make1_str("*"), $3); }
-               | '|' position_expr
-                               {       $$ = cat2_str(make1_str("|"), $2); }
-               | position_expr TYPECAST Typename
-                               {
-                                       $$ = cat3_str($1, make1_str("::"), $3);
-                               }
-               | CAST '(' position_expr AS Typename ')'
-                               {
-                                       $$ = cat3_str(make2_str(make1_str("cast("), $3), make1_str("as"), make2_str($5, make1_str(")")));
-                               }
-               | '(' position_expr ')'
-                               {       $$ = make3_str(make1_str("("), $2, make1_str(")")); }
-               | position_expr Op position_expr
-                               {       $$ = cat3_str($1, $2, $3); }
-               | Op position_expr
-                               {       $$ = cat2_str($1, $2); }
-               | position_expr Op
-                               {       $$ = cat2_str($1, $2); }
-               | ColId
-                               {
-                                       $$ = $1;
-                               }
-               | func_name '(' ')'
-                               {
-                                       $$ = cat2_str($1, make1_str("()"));
-                               }
-               | func_name '(' expr_list ')'
-                               {
-                                       $$ = make4_str($1, make1_str("("), $3, make1_str(")"));
-                               }
-               | POSITION '(' position_list ')'
-                               {
-                                       $$ = make3_str(make1_str("position("), $3, make1_str(")"));
-                               }
-               | SUBSTRING '(' substr_list ')'
-                               {
-                                       $$ = make3_str(make1_str("substring("), $3, make1_str(")"));
-                               }
-               /* various trim expressions are defined in SQL92 - thomas 1997-07-19 */
-               | TRIM '(' BOTH trim_list ')'
-                               {
-                                       $$ = make3_str(make1_str("trim(both"), $4, make1_str(")"));
-                               }
-               | TRIM '(' LEADING trim_list ')'
-                               {
-                                       $$ = make3_str(make1_str("trim(leading"), $4, make1_str(")"));
-                               }
-               | TRIM '(' TRAILING trim_list ')'
-                               {
-                                       $$ = make3_str(make1_str("trim(trailing"), $4, make1_str(")"));
-                               }
-               | TRIM '(' trim_list ')'
-                               {
-                                       $$ = make3_str(make1_str("trim("), $3, make1_str(")"));
-                               }
-               ;
-
 substr_list:  expr_list substr_from substr_for
                                {
                                        $$ = cat3_str($1, $2, $3);
@@ -4163,25 +4085,20 @@ case_default:  ELSE a_expr_or_null      { $$ = cat2_str(make1_str("else"), $2); }
                | /*EMPTY*/             { $$ = make1_str(""); }
                ;
 
-case_arg:  attr opt_indirection
-                               {
-                                       $$ = cat2_str($1, $2);
-                               }
-               | ColId
-                               {
+case_arg:  a_expr              {
                                        $$ = $1;
                                }
                | /*EMPTY*/
                                {       $$ = make1_str(""); }
                ;
 
-attr:  relation_name '.' attrs
+attr:  relation_name '.' attrs opt_indirection
                                {
-                                       $$ = make3_str($1, make1_str("."), $3);
+                                       $$ = make4_str($1, make1_str("."), $3, $4);
                                }
-               | ParamNo '.' attrs
+               | ParamNo '.' attrs opt_indirection
                                {
-                                       $$ = make3_str($1, make1_str("."), $3);
+                                       $$ = make4_str($1, make1_str("."), $3, $4);
                                }
                ;
 
@@ -4200,40 +4117,15 @@ attrs:    attr_name
  *
  *****************************************************************************/
 
-res_target_list:  res_target_list ',' res_target_el
-                               {       $$ = cat3_str($1, make1_str(","),$3);  }
-               | res_target_el
-                               {       $$ = $1;  }
-               | '*'           { $$ = make1_str("*"); }
-               ;
-
-res_target_el:  ColId opt_indirection '=' a_expr_or_null
-                               {
-                                       $$ = cat4_str($1, $2, make1_str("="), $4);
-                               }
-               | attr opt_indirection
-                               {
-                                       $$ = cat2_str($1, $2);
-                               }
-               | relation_name '.' '*'
-                               {
-                                       $$ = make2_str($1, make1_str(".*"));
-                               }
-               ;
-
-/*
-** target list for select.
-** should get rid of the other but is still needed by the defunct select into
-** and update (uses a subset)
-*/
-res_target_list2:  res_target_list2 ',' res_target_el2
+/* Target lists as found in SELECT ... and INSERT VALUES ( ... ) */
+target_list:  target_list ',' target_el
                                {       $$ = cat3_str($1, make1_str(","), $3);  }
-               | res_target_el2
+               | target_el
                                {       $$ = $1;  }
                ;
 
 /* AS is not optional because shift/red conflict with unary ops */
-res_target_el2:  a_expr_or_null AS ColLabel
+target_el:  a_expr_or_null AS ColLabel
                                {
                                        $$ = cat3_str($1, make1_str("as"), $3);
                                }
@@ -4251,10 +4143,26 @@ res_target_el2:  a_expr_or_null AS ColLabel
                                }
                ;
 
-opt_id:  ColId                                                                 { $$ = $1; }
-               | /* EMPTY */                                                   { $$ = make1_str(""); }
+/* Target list as found in UPDATE table SET ... */
+update_target_list:  update_target_list ',' update_target_el
+                               {       $$ = cat3_str($1, make1_str(","),$3);  }
+               | update_target_el
+                               {       $$ = $1;  }
+               | '*'           { $$ = make1_str("*"); }
+               ;
+
+update_target_el:  ColId opt_indirection '=' a_expr_or_null
+                               {
+                                       $$ = cat4_str($1, $2, make1_str("="), $4);
+                               }
                ;
 
+/*****************************************************************************
+ *
+ *     Names and constants
+ *
+ *****************************************************************************/
+
 relation_name: SpecialRuleRelation
                                {
                                        $$ = $1;
@@ -4303,7 +4211,10 @@ AexprConst:  Iconst
                                {
                                        $$ = $1;
                                }
-               | Typename Sconst
+                /* this rule formerly used Typename, but that causes reduce conf licts
+                  * with subscripted column names ...
+                  */
+               | SimpleTypename Sconst
                                {
                                        $$ = cat2_str($1, $2);
                                }
@@ -5170,19 +5081,19 @@ ECPGTypedef: TYPE_P symbol IS ctype opt_type_array_bounds opt_reference
                $$ = cat5_str(cat3_str(make1_str("/* exec sql type"), mm_strdup($2), make1_str("is")), mm_strdup($4.type_str), mm_strdup($5.str), $6, make1_str("*/"));
        }
 
-opt_type_array_bounds:  '[' ']' nest_type_array_bounds
+opt_type_array_bounds:  '[' ']' opt_type_array_bounds
                        {
                             $$.index1 = 0;
                             $$.index2 = $3.index1;
                             $$.str = cat2_str(make1_str("[]"), $3.str);
                         }
-               | '(' ')' nest_type_array_bounds
+               | '(' ')' opt_type_array_bounds
                        {
                             $$.index1 = 0;
                             $$.index2 = $3.index1;
                             $$.str = cat2_str(make1_str("[]"), $3.str);
                         }
-               | '[' Iresult ']' nest_type_array_bounds
+               | '[' Iresult ']' opt_type_array_bounds
                        {
                            char *txt = mm_alloc(20L);
 
@@ -5191,7 +5102,7 @@ opt_type_array_bounds:  '[' ']' nest_type_array_bounds
                             $$.index2 = $4.index1;
                             $$.str = cat4_str(make1_str("["), txt, make1_str("]"), $4.str);
                         }
-               | '(' Iresult ')' nest_type_array_bounds
+               | '(' Iresult ')' opt_type_array_bounds
                        {
                            char *txt = mm_alloc(20L);
 
@@ -5208,43 +5119,6 @@ opt_type_array_bounds:  '[' ']' nest_type_array_bounds
                         }
                ;
 
-nest_type_array_bounds:        '[' ']' nest_type_array_bounds
-                        {
-                            $$.index1 = 0;
-                            $$.index2 = $3.index1;
-                            $$.str = cat2_str(make1_str("[]"), $3.str);
-                        }
-               | '(' ')' nest_type_array_bounds
-                        {
-                            $$.index1 = 0;
-                            $$.index2 = $3.index1;
-                            $$.str = cat2_str(make1_str("[]"), $3.str);
-                        }
-               | '[' Iresult ']' nest_type_array_bounds
-                       {
-                           char *txt = mm_alloc(20L);
-
-                           sprintf (txt, "%d", $2);
-                            $$.index1 = $2;
-                            $$.index2 = $4.index1;
-                            $$.str = cat4_str(make1_str("["), txt, make1_str("]"), $4.str);
-                        }
-               | '(' Iresult ')' nest_type_array_bounds
-                       {
-                           char *txt = mm_alloc(20L);
-
-                           sprintf (txt, "%d", $2);
-                            $$.index1 = $2;
-                            $$.index2 = $4.index1;
-                            $$.str = cat4_str(make1_str("["), txt, make1_str("]"), $4.str);
-                        }
-               | /* EMPTY */
-                       {
-                            $$.index1 = -1;
-                            $$.index2 = -1;
-                            $$.str= make1_str("");
-                        }
-                ;
 opt_reference: SQL_REFERENCE { $$ = make1_str("reference"); }
        | /* empty */        { $$ = make1_str(""); }
 
@@ -5585,24 +5459,28 @@ action : SQL_CONTINUE {
 }
 
 /* some other stuff for ecpg */
-ecpg_expr:  attr opt_indirection
+ecpg_expr:  attr 
                                {
-                                       $$ = cat2_str($1, $2);
+                                       $$ = $1;
                                }
                | row_expr
                                {       $$ = $1;  }
                | AexprConst
                                {       $$ = $1;  }
-               | ColId
+               | ColId opt_indirection
                                {
-                                       $$ = $1;
+                                       $$ = cat2_str($1, $2);
                                }
                | '-' ecpg_expr %prec UMINUS
                                {       $$ = cat2_str(make1_str("-"), $2); }
                | '%' ecpg_expr
                                {       $$ = cat2_str(make1_str("%"), $2); }
+               | '^' ecpg_expr
+                               {       $$ = cat2_str(make1_str("^"), $2); }
                | a_expr '%'
                                {       $$ = cat2_str($1, make1_str("%")); }
+               | a_expr '^'
+                               {       $$ = cat2_str($1, make1_str("^")); }
                | a_expr '+' ecpg_expr
                                {       $$ = cat3_str($1, make1_str("+"), $3); }
                | a_expr '-' ecpg_expr
@@ -5613,6 +5491,8 @@ ecpg_expr:  attr opt_indirection
                                {       $$ = cat3_str($1, make1_str("%"), $3); }
                | a_expr '*' ecpg_expr
                                {       $$ = cat3_str($1, make1_str("*"), $3); }
+               | a_expr '^' ecpg_expr
+                               {       $$ = cat3_str($1, make1_str("^"), $3); }
                | a_expr '<' ecpg_expr
                                {       $$ = cat3_str($1, make1_str("<"), $3); }
                | a_expr '>' ecpg_expr