select row value from column's oid
select row value from column's oid
От:
Mathieu <viel@benchmark.fr>
Дата:
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? :)