Bruce Momjian writes:
 > Lee Kindness writes:
 > > In which case a number of other cases should be weeded out of
 > > parser.y and passed onto the backend:
 > > [ snip ]
 > > Let me known if you want a patch for these cases too.
 > Sure, send them on over.

Patch below, it changes:

 1. A number of mmerror(ET_ERROR) to mmerror(ET_NOTICE), passing on
    the (currently) unsupported options to the backend with warning.

 2. Standardises warning messages in such cases.

 3. Corrects typo in passing of 'CREATE FUNCTION/INOUT' parameter.

Patch:

? interfaces/ecpg/preproc/ecpg
Index: interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.161
diff -c -r1.161 preproc.y
*** interfaces/ecpg/preproc/preproc.y   2001/10/15 20:15:09     1.161
--- interfaces/ecpg/preproc/preproc.y   2001/10/16 09:15:53
***************
*** 1074,1084 ****
                | LOCAL TEMPORARY       { $$ = make_str("local temporary"); }
                | LOCAL TEMP            { $$ = make_str("local temp"); }
                | GLOBAL TEMPORARY      {
!                                         mmerror(ET_ERROR, "GLOBAL TEMPORARY TABLE is 
not currently supported");
                                          $$ = make_str("global temporary");
                                        }
                | GLOBAL TEMP           {
!                                         mmerror(ET_ERROR, "GLOBAL TEMPORARY TABLE is 
not currently supported");
                                          $$ = make_str("global temp");
                                        }
                | /*EMPTY*/             { $$ = EMPTY; }
--- 1074,1084 ----
                | LOCAL TEMPORARY       { $$ = make_str("local temporary"); }
                | LOCAL TEMP            { $$ = make_str("local temp"); }
                | GLOBAL TEMPORARY      {
!                                         mmerror(ET_NOTICE, "Currently unsupported 
CREATE TABLE/GLOBAL TEMPORARY will be passed to backend");
                                          $$ = make_str("global temporary");
                                        }
                | GLOBAL TEMP           {
!                                         mmerror(ET_NOTICE, "Currently unsupported 
CREATE TABLE/GLOBAL TEMP will be passed to backend");
                                          $$ = make_str("global temp");
                                        }
                | /*EMPTY*/             { $$ = EMPTY; }
***************
*** 1103,1110 ****
                                {
                                        if (strlen($4) > 0)
                                        {
!                                               sprintf(errortext, "CREATE 
TABLE/COLLATE %s not yet implemented; clause ignored", $4);
!                                               mmerror(ET_NOTICE, errortext);
                                        }
                                        $$ = cat_str(4, $1, $2, $3, $4);
                                }
--- 1103,1110 ----
                                {
                                        if (strlen($4) > 0)
                                        {
!                                               sprintf(errortext, "Currently 
unsupported CREATE TABLE/COLLATE %s will be passed to backend", $4);
!                                               mmerror(ET_NOTICE, errortext);
                                        }
                                        $$ = cat_str(4, $1, $2, $3, $4);
                                }
***************
*** 1219,1225 ****
                }
                | MATCH PARTIAL         
                {
!                       mmerror(ET_NOTICE, "FOREIGN KEY/MATCH PARTIAL not yet 
implemented");
                        $$ = make_str("match partial");
                }
                | /*EMPTY*/
--- 1219,1225 ----
                }
                | MATCH PARTIAL         
                {
!                       mmerror(ET_NOTICE, "Currently unsupported FOREIGN KEY/MATCH 
PARTIAL will be passed to backend");
                        $$ = make_str("match partial");
                }
                | /*EMPTY*/
***************
*** 1614,1620 ****
                | BACKWARD      { $$ = make_str("backward"); }
                | RELATIVE      { $$ = make_str("relative"); }
                  | ABSOLUTE    {
!                                       mmerror(ET_NOTICE, "FETCH/ABSOLUTE not 
supported, backend will use RELATIVE");
                                        $$ = make_str("absolute");
                                }
                ;
--- 1614,1620 ----
                | BACKWARD      { $$ = make_str("backward"); }
                | RELATIVE      { $$ = make_str("relative"); }
                  | ABSOLUTE    {
!                                       mmerror(ET_NOTICE, "Currently unsupported 
FETCH/ABSOLUTE will be passed to backend, backend will use RELATIVE");
                                        $$ = make_str("absolute");
                                }
                ;
***************
*** 1769,1775 ****
                | grantee_list ',' grantee      { $$ = cat_str(3, $1, make_str(","), 
$3); }
                ;
  
! opt_with_grant:  WITH GRANT OPTION { $$ = make_str("with grant option"); }
                | /*EMPTY*/ { $$ = EMPTY; }
                ;
  
--- 1769,1779 ----
                | grantee_list ',' grantee      { $$ = cat_str(3, $1, make_str(","), 
$3); }
                ;
  
! opt_with_grant:  WITH GRANT OPTION
!                                 {
!                                       mmerror(ET_NOTICE, "Currently unsupported 
GRANT/WITH GRANT OPTION will be passed to backend");
!                                       $$ = make_str("with grant option");
!                               }
                | /*EMPTY*/ { $$ = EMPTY; }
                ;
  
***************
*** 1919,1932 ****
  
  opt_arg:  IN    { $$ = make_str("in"); }
        | OUT   { 
!                 mmerror(ET_ERROR, "CREATE FUNCTION/OUT parameters are not 
supported");
  
                  $$ = make_str("out");
                }
        | INOUT { 
!                 mmerror(ET_ERROR, "CREATE FUNCTION/INOUT parameters are not 
supported");
  
!                 $$ = make_str("oinut");
                }
        ;
  
--- 1923,1936 ----
  
  opt_arg:  IN    { $$ = make_str("in"); }
        | OUT   { 
!                 mmerror(ET_NOTICE, "Currently unsupported CREATE FUNCTION/OUT will 
be passed to backend");
  
                  $$ = make_str("out");
                }
        | INOUT { 
!                 mmerror(ET_NOTICE, "Currently unsupported CREATE FUNCTION/INOUT will 
be passed to backend");
  
!                 $$ = make_str("inout");
                }
        ;
  
***************
*** 2164,2170 ****
  
  opt_chain: AND NO CHAIN       { $$ = make_str("and no chain"); }
        | AND CHAIN             {
!                                 mmerror(ET_ERROR, "COMMIT/CHAIN not yet supported");
  
                                  $$ = make_str("and chain");
                                }
--- 2168,2174 ----
  
  opt_chain: AND NO CHAIN       { $$ = make_str("and no chain"); }
        | AND CHAIN             {
!                                 mmerror(ET_NOTICE, "Currently unsupported 
COMMIT/CHAIN will be passed to backend");
  
                                  $$ = make_str("and chain");
                                }
***************
*** 2609,2620 ****
                        }
                         | GLOBAL TEMPORARY opt_table relation_name
                          {
!                               mmerror(ET_ERROR, "GLOBAL TEMPORARY TABLE is not 
currently supported");
                                $$ = cat_str(3, make_str("global temporary"), $3, $4);
                          }
                         | GLOBAL TEMP opt_table relation_name
                          {
!                               mmerror(ET_ERROR, "GLOBAL TEMPORARY TABLE is not 
currently supported");
                                $$ = cat_str(3, make_str("global temp"), $3, $4);
                          }
                         | TABLE relation_name
--- 2613,2624 ----
                        }
                         | GLOBAL TEMPORARY opt_table relation_name
                          {
!                               mmerror(ET_NOTICE, "Currently unsupported CREATE 
TABLE/GLOBAL TEMPORARY will be passed to backend");
                                $$ = cat_str(3, make_str("global temporary"), $3, $4);
                          }
                         | GLOBAL TEMP opt_table relation_name
                          {
!                               mmerror(ET_NOTICE, "Currently unsupported CREATE 
TABLE/GLOBAL TEMP will be passed to backend");
                                $$ = cat_str(3, make_str("global temp"), $3, $4);
                          }
                         | TABLE relation_name

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to