SQL Server → PostgreSQL

Syntax Error: Where to Put the ALIAS in PostgreSQL UPDATE

PostgreSQL rejects UPDATE my_table t SET t.column = .... Learn the correct alias syntax in UPDATE.

In SQL Server it is common to write UPDATE table alias SET alias.col = .... PostgreSQL's parser does not accept the alias right after the table name in a simple UPDATE.

PostgreSQL rule

Wrong in PostgreSQL

UPDATE orders p SET p.status = 'OK' WHERE p.id = 1;

Correct

UPDATE orders SET status = 'OK' WHERE id = 1;

Analisador de Impacto

Paste scripts with UPDATE + JOIN into the Impact Analyzer — alias and JOIN are two of the most common migration errors.

Abrir Análise de Projeto →