I encountered a strange issue this morning. I was creating a view simplifying a list of applications in a Postgres table.
This failed.
CREATE OR REPLACE VIEW application_view AS
SELECT COALESCE( nullif(full_name,''), nullif(additional_info,''), app_name) name
, id
FROM application
ORDER BY COALESCE( nullif(full_name,''), nullif(additional_info,''), app_name)
whereas
CREATE OR REPLACE VIEW application_view AS
SELECT COALESCE( nullif(full_name,''), nullif(additional_info,''), app_name) application
, id
FROM application
ORDER BY COALESCE( nullif(full_name,''), nullif(additional_info,''), app_name)
worked.
I often use name as a column name in tables so any ideas as to why the first sql statement failed?