Thread: Bug in Create sequence parsing?

Bug in Create sequence parsing?

From
postgres
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        :    Adam Boileau
Your email address    :    metlstrm@ihug.co.nz
                postgres@euclid.ihug.co.nz


System Configuration
---------------------
  Architecture (example: Intel Pentium)      :   Dual Intel P2

  Operating System (example: Linux 2.0.26 ELF)     :   Linux 2.2.10

  PostgreSQL version (example: PostgreSQL-6.5.3):   PostgreSQL-6.5.3

  Compiler used (example:  gcc 2.8.0)        :   gcc 2.95.1


Please enter a FULL description of your problem:
------------------------------------------------

Creating a sequence whose maxvalue is > signed-4-byte-int-max generates a parse error.
Inserting the same value into an int8 field works, however.
Conclusion: create sequence doesnt parse > int4, but insert does.



Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

euclid=> create table test (Im_big int8);
CREATE

--Insert int4-max + 1
euclid=> insert into test values (2147483648);
INSERT 192329 1

--Create a sequence whose maxval is int4-max
euclid=> create sequence im_big_seq maxvalue 2147483647;
CREATE

--Hmm, works great.
euclid=> drop sequence im_big_seq;
DROP

--Create a sequence whose maxval is int4-max + 1
euclid=> create sequence im_big_seq maxvalue 2147483648;
ERROR:  parser: parse error at or near "2147483648"
ERROR:  parser: parse error at or near "2147483648"

--No sir, I dont like it.


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------




Re: Bug in Create sequence parsing?

From
Bruce Momjian
Date:
Seems we don't support int8 sequences.  Should we?  I don't see a good
use for them.



> ============================================================================
>                         POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
>
> Your name        :    Adam Boileau
> Your email address    :    metlstrm@ihug.co.nz
>                 postgres@euclid.ihug.co.nz
>
>
> System Configuration
> ---------------------
>   Architecture (example: Intel Pentium)      :   Dual Intel P2
>
>   Operating System (example: Linux 2.0.26 ELF)     :   Linux 2.2.10
>
>   PostgreSQL version (example: PostgreSQL-6.5.3):   PostgreSQL-6.5.3
>
>   Compiler used (example:  gcc 2.8.0)        :   gcc 2.95.1
>
>
> Please enter a FULL description of your problem:
> ------------------------------------------------
>
> Creating a sequence whose maxvalue is > signed-4-byte-int-max generates a parse error.
> Inserting the same value into an int8 field works, however.
> Conclusion: create sequence doesnt parse > int4, but insert does.
>
>
>
> Please describe a way to repeat the problem.   Please try to provide a
> concise reproducible example, if at all possible:
> ----------------------------------------------------------------------
>
> euclid=> create table test (Im_big int8);
> CREATE
>
> --Insert int4-max + 1
> euclid=> insert into test values (2147483648);
> INSERT 192329 1
>
> --Create a sequence whose maxval is int4-max
> euclid=> create sequence im_big_seq maxvalue 2147483647;
> CREATE
>
> --Hmm, works great.
> euclid=> drop sequence im_big_seq;
> DROP
>
> --Create a sequence whose maxval is int4-max + 1
> euclid=> create sequence im_big_seq maxvalue 2147483648;
> ERROR:  parser: parse error at or near "2147483648"
> ERROR:  parser: parse error at or near "2147483648"
>
> --No sir, I dont like it.
>
>
> If you know how this problem might be fixed, list the solution below:
> ---------------------------------------------------------------------
>
>
>
>
> ************
>
>


--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@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

Re: Bug in Create sequence parsing?

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Seems we don't support int8 sequences.  Should we?  I don't see a good
> use for them.

Sooner or later we'll probably want to offer an option to make OID be
8 bytes.  I could see switching sequences to int8 as well when we
do that.  Of course it would not work on platforms without compiler
support for 64-bit integers...

            regards, tom lane