0

I changed the database in the project from MySQL to PostgreSQL and made a query like this:

alter table book add image varchar(128) after currency;

I get this error: Reason: liquibase.exception.DatabaseException: ERROR: syntax error at or near "after"

I suspect there's a syntax error somewhere, just not too sure where it might be.

JksSower
  • 11
  • 4
  • 1
    In postgres, [there is no `after` (`postgres.org`)](https://www.postgresql.org/docs/current/sql-altertable.html). – Turing85 Nov 27 '22 at 17:22
  • 2
    This is why there is documentation [Alter Table](https://www.postgresql.org/docs/current/sql-altertable.html). – Adrian Klaver Nov 27 '22 at 17:25
  • In PostgreSQL, the column position is based on the order you add the columns. You can't specify the column position. See the PostgreSQL wiki: https://wiki.postgresql.org/wiki/Alter_column_position Note the SQL standard does not obligate PostgreSQL to have this feature. It's a MySQL-ism. – Bill Karwin Nov 27 '22 at 18:23

0 Answers0