Name array type doesn't parse
See original GitHub issueI’m doing reflection on my PostgreSQL database and I have this query:
select
n.nspname as "schemaName",
t.typname as "name",
array(
select
e.enumlabel
from
pg_catalog.pg_enum as e
where
e.enumtypid = t.oid
) as "variants"
from
pg_catalog.pg_type as t
left join pg_catalog.pg_namespace as n on n.oid = t.typnamespace
where
t.typtype = 'e';
Which has a sample result of:
schemaName | name | variants
------------+------------+-------------------
public | bug_status | {new,open,closed}
a | letter | {a,b,c,d}
b | color | {red,green,blue}
(3 rows)
I’d expect the pg
module to parse the variants
column as an array of strings, but that’s not what happens. Instead the variants
column is the string {a,b,c,d}
for example.
After some digging the type appears to be named _name
with an id of 1003, which is an array type for name
with an oid of 19. For more information:
select typname, oid, typarray from pg_type where oid in (1003, 19);
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to parse C# generic type names? - Stack Overflow
Well, I had a lot of fun writing this little parsing class using Regex and named capture groups (?<Name>group) .
Read more >Bug: Query string array parsing doesn't work properly on large ...
Describe the bug. I need to send an array of objects through query string to express-validator. To do so, I call the route...
Read more >Error when trying to use output of Parse JSON
In your schema, it's assigning a type of "array" to one of the values. And that value is coming back in the results...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >Documentation - Everyday Types - TypeScript
In this chapter, we'll cover some of the most common types of values you'll find in JavaScript code, and explain the corresponding ways...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vitaly-t not certain, but
vehicle
looks like a custom type, sovehicle[]
probably wouldn’t (and couldn’t) be included inpg-types
parsing.I agree. You can fix this by typecasting to text (I guess) in your nested query for now: