SELECT conname, consrc, contype, indkey FROM ( SELECT conname, CASEWHEN contype='f'THEN pg_catalog.pg_get_constraintdef(oid) ELSE 'CHECK (' || consrc || ')' ENDAS consrc, contype, conrelid AS relid, NULLAS indkey FROM pg_catalog.pg_constraint WHERE contype IN ('f', 'c') UNION ALL SELECT pc.relname, NULL, CASEWHEN indisprimary THEN 'p' ELSE 'u' END, pi.indrelid, indkey FROM pg_catalog.pg_class pc, pg_catalog.pg_index pi WHERE pc.oid=pi.indexrelid ANDEXISTS ( SELECT1FROM pg_catalog.pg_depend d JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) WHERE d.classid = pc.tableoid AND d.objid = pc.oid AND d.deptype = 'i'AND c.contype IN ('u', 'p') ) ) AS sub WHERE relid = (SELECToidFROM pg_catalog.pg_class WHERE relname='coin_businesses' AND relnamespace = (SELECToidFROM pg_catalog.pg_namespace WHERE nspname='freecoin'))