6

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.

2 Answers 2

13

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.

Sign up to request clarification or add additional context in comments.

Comments

4

Some workaround that works for me. In this case, you simply have to remove AS integer from the dump file.

sed 's/    AS integer$//g' your_dump_file.out > tmp.out
mv tmp.out your_dump_file.out

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.