Search code examples
postgresqlpostgresql-9.3postgresql-11

Syntax error at or near AS integer when creating a sequence


I am getting "error at or near AS integer" in below code when I am trying to execute with psql.

CREATE SEQUENCE public.auth_group_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

The above sql statement is from the backup file of local machine postgres version 11 and executing in EC2 postgres version 9.3. I am new to postgres and getting no idea as the sql is generated by postgres only so it should work with psql. Thanks in advance.


Solution

  • Postgres 9.3 (which is no longer supported) did not support the AS data_type option. This was introduced in version 10.

    You could try using pg_dump from your 9.3 installation to do the dump, but I am not sure if that works.