Re: [PORTS] Port Bug Report: Wrong binding of arithmetic operator ^.

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [PORTS] Port Bug Report: Wrong binding of arithmetic operator ^.
Дата
Msg-id 199907072350.TAA16133@candle.pha.pa.us
обсуждение исходный текст
Ответ на Port Bug Report: Wrong binding of arithmetic operator ^.  (Unprivileged user <nobody>)
Список pgsql-ports
> Problem Description:
> --------------------
> select 2 + 3^2; results in 25 instead of 11;
> select 2 + (3^2); results correctly in 11.

OK, fixed.  This fix willl appear in 6.5.1, due out next week:

    test=> select 2 + 3^2;
    ?column?
    --------
          11
    (1 row)


--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
? doc/_xlk
? src/Makefile.custom
? src/config.log
? src/log
? src/config.cache
? src/config.status
? src/GNUmakefile
? src/Makefile.global
? src/backend/fmgr.h
? src/backend/parse.h
? src/backend/postgres
? src/backend/global1.bki.source
? src/backend/local1_template1.bki.source
? src/backend/global1.description
? src/backend/local1_template1.description
? src/backend/bootstrap/bootparse.c
? src/backend/bootstrap/bootstrap_tokens.h
? src/backend/bootstrap/bootscanner.c
? src/backend/catalog/genbki.sh
? src/backend/catalog/global1.bki.source
? src/backend/catalog/global1.description
? src/backend/catalog/local1_template1.bki.source
? src/backend/catalog/local1_template1.description
? src/backend/port/Makefile
? src/backend/utils/Gen_fmgrtab.sh
? src/backend/utils/fmgr.h
? src/backend/utils/fmgrtab.c
? src/bin/cleardbdir/cleardbdir
? src/bin/createdb/createdb
? src/bin/createlang/createlang
? src/bin/createuser/createuser
? src/bin/destroydb/destroydb
? src/bin/destroylang/destroylang
? src/bin/destroyuser/destroyuser
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_dump/Makefile
? src/bin/pg_dump/pg_dump
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pg_version/Makefile
? src/bin/pg_version/pg_version
? src/bin/pgtclsh/mkMakefile.tcldefs.sh
? src/bin/pgtclsh/mkMakefile.tkdefs.sh
? src/bin/pgtclsh/Makefile.tkdefs
? src/bin/pgtclsh/Makefile.tcldefs
? src/bin/pgtclsh/pgtclsh
? src/bin/pgtclsh/pgtksh
? src/bin/psql/Makefile
? src/bin/psql/psql
? src/include/version.h
? src/include/config.h
? src/interfaces/ecpg/lib/Makefile
? src/interfaces/ecpg/lib/libecpg.so.3.0.0
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/libpgtcl/Makefile
? src/interfaces/libpgtcl/libpgtcl.so.2.0
? src/interfaces/libpq/Makefile
? src/interfaces/libpq/libpq.so.2.0
? src/interfaces/libpq++/Makefile
? src/interfaces/libpq++/libpq++.so.3.0
? src/interfaces/odbc/GNUmakefile
? src/interfaces/odbc/Makefile.global
? src/lextest/lex.yy.c
? src/lextest/lextest
? src/pl/plpgsql/src/Makefile
? src/pl/plpgsql/src/mklang.sql
? src/pl/plpgsql/src/pl_gram.c
? src/pl/plpgsql/src/pl.tab.h
? src/pl/plpgsql/src/pl_scan.c
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/pl/tcl/mkMakefile.tcldefs.sh
? src/pl/tcl/Makefile.tcldefs
? src/template/linux_m68k
Index: doc/TODO
===================================================================
RCS file: /usr/local/cvsroot/pgsql/doc/TODO,v
retrieving revision 1.46
diff -c -r1.46 TODO
*** TODO    1999/07/07 17:17:46    1.46
--- TODO    1999/07/07 23:47:32
***************
*** 29,36 ****
  * Select a[1] FROM test fails, it needs test.a[1]
  * Array index references without table name cause problems
  * Update table SET table.value = 3 fails
! * Creating index of timestamp fails
  * SELECT foo UNION SELECT foo is incorrectly simplified to SELECT foo

  VIEWS

--- 29,38 ----
  * Select a[1] FROM test fails, it needs test.a[1]
  * Array index references without table name cause problems
  * Update table SET table.value = 3 fails
! * Creating index of TIMESTAMP fails, rename to DATETIME(Thomas)
  * SELECT foo UNION SELECT foo is incorrectly simplified to SELECT foo
+ * INSERT ... SELECT ... GROUP BY groups by target columns not source columns
+ * CREATE TABLE test (a char(5) DEFAULT text '', b int4) fails on INSERT

  VIEWS

***************
*** 80,86 ****
  * Large objects
      o Fix large object mapping scheme, own typeid or reltype(Peter)
      o Allow large text type to use large objects(Peter)
!     o Not to stuff everything as files in a single directory
  * Allow pg_descriptions when creating types, tables, columns, and functions
  * Add IPv6 capability to INET/CIDR types
  * Make a separate SERIAL type?
--- 82,88 ----
  * Large objects
      o Fix large object mapping scheme, own typeid or reltype(Peter)
      o Allow large text type to use large objects(Peter)
!     o Not to stuff everything as files in a single directory, hash dirs
  * Allow pg_descriptions when creating types, tables, columns, and functions
  * Add IPv6 capability to INET/CIDR types
  * Make a separate SERIAL type?
***************
*** 182,198 ****
    a matching index
  * Improve LIMIT processing by using index to limit rows processed
  * Have optimizer take LIMIT into account when considering index scans

  CACHE

  * Cache most recent query plan(s?)
  * Shared catalog cache, reduce lseek()'s by caching table size in shared area

  MISC

  * Allow compression of log and meta data
  * Update pg_statistic table to remove operator column
- * Make index creation use psort code, because it is now faster(Vadim)
  * Allow char() not to use variable-sized header to reduce disk size
  * Do async I/O to do better read-ahead of data
  * Fix memory exhaustion when using many OR's
--- 184,204 ----
    a matching index
  * Improve LIMIT processing by using index to limit rows processed
  * Have optimizer take LIMIT into account when considering index scans
+ * Make index creation use psort code, because it is now faster(Vadim)
+ * Create more system table indexes for faster cache lookups
+ * fix indexscan() so it does leak memory by not requiring caller to free
+ * Improve _bt_binsrch() to handle equal keys better, remove _bt_firsteq()(Tom)

  CACHE

  * Cache most recent query plan(s?)
  * Shared catalog cache, reduce lseek()'s by caching table size in shared area
+ * elog() flushes cache, try invalidating just entries from current xact

  MISC

  * Allow compression of log and meta data
  * Update pg_statistic table to remove operator column
  * Allow char() not to use variable-sized header to reduce disk size
  * Do async I/O to do better read-ahead of data
  * Fix memory exhaustion when using many OR's
***************
*** 201,215 ****
  * Use mmap() rather than SYSV shared memory(?)
  * Process const = const parts of OR clause in separate pass
  * Make oid use oidin/oidout not int4in/int4out in pg_type.h
- * Create more system table indexes for faster cache lookups
  * Improve Subplan list handling
  * Allow Subplans to use efficient joins(hash, merge) with upper variable
  * use fmgr_info()/fmgr_faddr() instead of fmgr() calls in high-traffic
    places, like GROUP BY, UNIQUE, index processing, etc.
  * improve dynamic memory allocation by introducing tuple-context memory
    allocation
! * fix indexscan() so it does leak memory by not requiring caller to free
! * fix memory leak in cache code when non-existant table is refer

  SOURCE CODE
  -----------
--- 207,221 ----
  * Use mmap() rather than SYSV shared memory(?)
  * Process const = const parts of OR clause in separate pass
  * Make oid use oidin/oidout not int4in/int4out in pg_type.h
  * Improve Subplan list handling
  * Allow Subplans to use efficient joins(hash, merge) with upper variable
  * use fmgr_info()/fmgr_faddr() instead of fmgr() calls in high-traffic
    places, like GROUP BY, UNIQUE, index processing, etc.
  * improve dynamic memory allocation by introducing tuple-context memory
    allocation
! * fix memory leak in cache code when non-existant table is referenced
! * In WHERE x=3 AND x=y, add y=3
! * pass atttypmod through parser in more cases(Bruce)

  SOURCE CODE
  -----------
Index: src/backend/parser/gram.y
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.86
diff -c -r2.86 gram.y
*** gram.y    1999/07/04 04:55:59    2.86
--- gram.y    1999/07/07 23:48:01
***************
*** 349,355 ****
  %nonassoc    NULL_P
  %nonassoc    IS
  %left        '+' '-'
! %left        '*' '/' '%'
  %left        '|'                /* this is the relation union op, not logical or */
  /* Unary Operators */
  %right        ':'
--- 349,355 ----
  %nonassoc    NULL_P
  %nonassoc    IS
  %left        '+' '-'
! %left        '*' '/' '%' '^'
  %left        '|'                /* this is the relation union op, not logical or */
  /* Unary Operators */
  %right        ':'
***************
*** 973,978 ****
--- 973,980 ----
                  {    $$ = nconc( $1, lcons( makeString( "%"), $3)); }
              | default_expr '*' default_expr
                  {    $$ = nconc( $1, lcons( makeString( "*"), $3)); }
+             | default_expr '^' default_expr
+                 {    $$ = nconc( $1, lcons( makeString( "^"), $3)); }
              | default_expr '=' default_expr
                  {    elog(ERROR,"boolean expressions not supported in DEFAULT"); }
              | default_expr '<' default_expr
***************
*** 1121,1126 ****
--- 1123,1130 ----
                  {    $$ = nconc( $1, lcons( makeString( "%"), $3)); }
              | constraint_expr '*' constraint_expr
                  {    $$ = nconc( $1, lcons( makeString( "*"), $3)); }
+             | constraint_expr '^' constraint_expr
+                 {    $$ = nconc( $1, lcons( makeString( "^"), $3)); }
              | constraint_expr '=' constraint_expr
                  {    $$ = nconc( $1, lcons( makeString( "="), $3)); }
              | constraint_expr '<' constraint_expr
***************
*** 3641,3648 ****
--- 3645,3656 ----
                  {    $$ = doNegate($2); }
          | '%' a_expr
                  {    $$ = makeA_Expr(OP, "%", NULL, $2); }
+         | '^' a_expr
+                 {    $$ = makeA_Expr(OP, "^", NULL, $2); }
          | a_expr '%'
                  {    $$ = makeA_Expr(OP, "%", $1, NULL); }
+         | a_expr '^'
+                 {    $$ = makeA_Expr(OP, "^", $1, NULL); }
          | a_expr '+' a_expr
                  {    $$ = makeA_Expr(OP, "+", $1, $3); }
          | a_expr '-' a_expr
***************
*** 3653,3658 ****
--- 3661,3668 ----
                  {    $$ = makeA_Expr(OP, "%", $1, $3); }
          | a_expr '*' a_expr
                  {    $$ = makeA_Expr(OP, "*", $1, $3); }
+         | a_expr '^' a_expr
+                 {    $$ = makeA_Expr(OP, "^", $1, $3); }
          | a_expr '<' a_expr
                  {    $$ = makeA_Expr(OP, "<", $1, $3); }
          | a_expr '>' a_expr
***************
*** 4302,4309 ****
--- 4312,4323 ----
                  {    $$ = doNegate($2); }
          | '%' b_expr
                  {    $$ = makeA_Expr(OP, "%", NULL, $2); }
+         | '^' b_expr
+                 {    $$ = makeA_Expr(OP, "^", NULL, $2); }
          | b_expr '%'
                  {    $$ = makeA_Expr(OP, "%", $1, NULL); }
+         | b_expr '^'
+                 {    $$ = makeA_Expr(OP, "^", $1, NULL); }
          | b_expr '+' b_expr
                  {    $$ = makeA_Expr(OP, "+", $1, $3); }
          | b_expr '-' b_expr
***************
*** 4312,4317 ****
--- 4326,4333 ----
                  {    $$ = makeA_Expr(OP, "/", $1, $3); }
          | b_expr '%' b_expr
                  {    $$ = makeA_Expr(OP, "%", $1, $3); }
+         | b_expr '^' b_expr
+                 {    $$ = makeA_Expr(OP, "^", $1, $3); }
          | b_expr '*' b_expr
                  {    $$ = makeA_Expr(OP, "*", $1, $3); }
          | ':' b_expr
Index: src/backend/parser/scan.l
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/parser/scan.l,v
retrieving revision 1.49
diff -c -r1.49 scan.l
*** scan.l    1999/05/12 07:12:51    1.49
--- scan.l    1999/07/07 23:48:09
***************
*** 155,161 ****

  typecast        "::"

! self            [,()\[\].;$\:\+\-\*\/\%\<\>\=\|]
  op_and_self        [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
  operator        {op_and_self}+

--- 155,161 ----

  typecast        "::"

! self            [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
  op_and_self        [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
  operator        {op_and_self}+


В списке pgsql-ports по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [PORTS] Port Bug Report: Insertion of line return character inconsistent.
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [PORTS] IRIX 6.5 meets Postgresql 6.5 (June 4 Snapshot)