Sample Header Ad - 728x90

Missing "public" schema when converting a "regclass" value to text

1 vote
1 answer
1202 views
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?
Asked by tinlyx (3820 rep)
May 26, 2018, 12:21 AM
Last activity: Apr 6, 2022, 08:15 PM