Re: SERIAL data type
Posted in 1995
Enda Finnan writes: >Does anyone if their is a mechanism or workaround to get the SERIAL datatype >to wrap back to 1 (or some other value) when it reaches its maximum (2147483647) A quick test confirms this happens automatically. #1. Create a table with a single serial column and insert into it the value 2147483645. #2. Insert a value of 0 and select * from the table. Result: 2147483645 2147483646 Repeat step #2. Result: 2147483645 2147483646 2147483647 Repeat step #2 again. Result: 1 2147483645 2147483646 2147483647 Of course, if a row is in the table already with the value 1 stored in the serial column, the next available number will be selected. And if this happens, your 'value 1' data likely is so old as to be useless and needs to be stored in a flat file on a tape somewhere, and old data deleted. Bill Williams E-Mail: bwilliam@jaxnet.com Flames: nobody@nowhere.com -or- redirect to /dev/null +-----------------------------------------------------------------+ | Disclaimer: My views, opinions, and judgments are my own. | +-----------------------------------------------------------------+ | "Free scientific inquiry" is a redundancy. | | "Free governmental inquiry" is self-contradictory. | | | | Be sure to read "Atlas Shrugged" by Ayn Rand. It's the world's | | greatest novel, rated #2 of those books readers said had the | | most impact on their lives (NY Times readership poll)! | +-----------------------------------------------------------------+