HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlModerate

ERROR: could not find array type for datatype information_schema.sql_identifier

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
errordatatypearrayinformation_schemacouldtypesql_identifierforfindnot

Problem

I am trying to run the below sql command:

SELECT ARRAY(
    SELECT column_name 
    FROM information_schema.columns 
    WHERE table_name ='gis_field_configuration_stage'
);


and I get the below error:

ERROR:  could not find array type for datatype information_schema.sql_identifier

Solution

Just cast column_name to text to bypass the error:

SELECT ARRAY(
    SELECT column_name::text
    FROM information_schema.columns 
    WHERE table_name ='gis_field_configuration_stage'
);


Its original type is information_schema.sql_identifier and its happens that an array of that type is not provided in the predefined types.

Code Snippets

SELECT ARRAY(
    SELECT column_name::text
    FROM information_schema.columns 
    WHERE table_name ='gis_field_configuration_stage'
);

Context

StackExchange Database Administrators Q#32975, answer score: 10

Revisions (0)

No revisions yet.