I am writing a script in which I need to parse the name of a table (in regclass
). The parsing (with parse_ident()
) works so far. However, the script fails when the table is in the public
schema because PostgreSQL (10.3) automatically removes the schema name.
For example, if a table tt
is in a non-public
schema ex
, the text value of the regclass
is the same as the original:
=> select 'ex.tt'::regclass::text;
text
-------
ex.tt
When it's in public
, the schema name is lost:
=> select 'public.tt'::regclass::text;
text
------
tt
Is there an way to disable this behavior, or to convert to text
without losing the schema name?