Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
lets say I create a type like this:
CREATE TYPE books AS ( book_id NUMERIC , row_num NUMERIC );
I want to write a query that returns me the attributes (book_id, row_num) of books.
I am not sure how to do this?
Use this
SELECT array_agg(a.attname) FROM pg_class c JOIN pg_attribute a ON c.oid = a.attrelid WHERE c.relname = 'books';
Result
array_agg ------------------- {book_id,row_num} (1 row)
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.