• Tom Lane's avatar
    COMMENT ON casts, conversions, languages, operator classes, and · 42ce74bf
    Tom Lane authored
    large objects.  Dump all these in pg_dump; also add code to pg_dump
    user-defined conversions.  Make psql's large object code rely on
    the backend for inserting/deleting LOB comments, instead of trying to
    hack pg_description directly.  Documentation and regression tests added.
    
    Christopher Kings-Lynne, code reviewed by Tom
    42ce74bf
sequence.sql 1005 Bytes
---
--- test creation of SERIAL column
---
 
CREATE TABLE serialTest (f1 text, f2 serial);
 
INSERT INTO serialTest VALUES ('foo');
INSERT INTO serialTest VALUES ('bar');
INSERT INTO serialTest VALUES ('force', 100);
INSERT INTO serialTest VALUES ('wrong', NULL);
 
SELECT * FROM serialTest;
 
CREATE SEQUENCE sequence_test;
 
BEGIN;
SELECT nextval('sequence_test');
DROP SEQUENCE sequence_test;
END;

-- renaming sequences
CREATE SEQUENCE foo_seq;
ALTER TABLE foo_seq RENAME TO foo_seq_new;
SELECT * FROM foo_seq_new;
DROP SEQUENCE foo_seq_new;

--
-- Alter sequence
--
CREATE SEQUENCE sequence_test2 START WITH 32;

SELECT nextval('sequence_test2');

ALTER SEQUENCE sequence_test2 RESTART WITH 16
	 INCREMENT BY 4 MAXVALUE 22 MINVALUE 5 CYCLE;
SELECT nextval('sequence_test2');
SELECT nextval('sequence_test2');
SELECT nextval('sequence_test2');

-- Test comments
COMMENT ON SEQUENCE asdf IS 'won''t work';
COMMENT ON SEQUENCE sequence_test2 IS 'will work';
COMMENT ON SEQUENCE sequence_test2 IS NULL;