0

Using EnterpriseDB I am not able to create/drop SYNONYM with name 'END'

DROP SYNONYM END;
CREATE SYNONYM END FOR TABLENAME;

I am getting similar issue while creating table with column name REFERENCES:

create tab1
( name character varying(250), 
REFERENCES character varying(250) ) 

I am converting the table from Oracle to Postgres (EntrepriseDB). In Oracle (END, REFERENCES) are used. Hence I need to use the same words here, too. Is there any way to use the reserved key words as synonyms name and column name?

2
  • 3
    I can see the code as a nightmare: SELECT CASE "END" WHEN 'END' THEN NAME ELSE "END" END "END", ... Commented Oct 17, 2016 at 9:46
  • with double quotes it is started working Commented Oct 17, 2016 at 10:00

1 Answer 1

3

END and REFERENCES are both reserved keywords.

So if you really want to use them as names (of tables, columns, schemata, synonyms, ... whatever), you have to double-quote them, the same way as in Oracle:

CREATE SYNONYM "END" ... ;
DROP SYNONYM "END" ;

CREATE tab1
( name character varying(250), 
  "REFERENCES" character varying(250)
) ;

The problem is that you have to always double-quote them everywhere and match the case. "END" is not the same as "End" nor "end" nor "eNd", etc.

It would be much easier to use non-reserved words for all identifiers.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.