Did you know?
You can’t use the `IF EXISTS` clause directly with the `RENAME` clause in PostgresQl
PostgresQl does not provide the `IF EXISTS` clause to check if a column exists when you try to rename it with the RENAME clause.
If you also try to rename a column that does not exist Postgres will throw an error. 🤷🏼♂️🤷🏼♂️
So how do you check if the column exists before you try to rename it?
See solution in the image.
Like and follow for more tips.
#coding #javascript #backend #postgresql #sql
#codeWithCipher
You can’t use the `IF EXISTS` clause directly with the `RENAME` clause in PostgresQl
PostgresQl does not provide the `IF EXISTS` clause to check if a column exists when you try to rename it with the RENAME clause.
If you also try to rename a column that does not exist Postgres will throw an error. 🤷🏼♂️🤷🏼♂️
So how do you check if the column exists before you try to rename it?
See solution in the image.
Like and follow for more tips.
#coding #javascript #backend #postgresql #sql
#codeWithCipher