select row value from column's oid
| От | Mathieu |
|---|---|
| Тема | select row value from column's oid |
| Дата | |
| Msg-id | 0a17a615-34a4-4d21-933b-944b6446d403@c58g2000hsc.googlegroups.com обсуждение исходный текст |
| Список | pgsql-general |
Hi guys.
I'd like to make a sql request able to get both row value and column
name of a table for a specific id.
Since I need the column name in my process, i first got interested in
a way to get this info from pg tables with this request :
SELECT
a.attname as "column_name"
FROM
pg_catalog.pg_attribute a
WHERE
a.attnum > 0
AND NOT a.attisdropped
AND a.attrelid = (
SELECT c.oid
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = 'my_table_name_here'
AND pg_catalog.pg_table_is_visible(c.oid)
)
This is working fine but i would like this same request to select both
my "column_name" AND my "row_value"; so i thought : "let's add a JOIN
statement and select my row value depending on my specific id and my
column name or OID or whatever i can find in my pg_attribute
table" ... but i can't find a way to do it!
Any idea? :)
В списке pgsql-general по дате отправления: