SELECT attname AS name, attrelid AS tid,coalesce((SELECT attnum = ANY (conkey) FROM pg_constraint WHERE contype = 'p' AND conrelid = attrelid), false) AS primarykey,not(attnotnull) AS allownull,(SELECT seq.oid FROM pg_class seq LEFT JOIN pg_depend dep ON seq.oid = dep.objid WHERE seq.relkind = 'S'::char AND dep.refobjsubid = attnum AND dep.refobjid = attrelid) IS NOT NULL AS autoincrement FROM pg_attribute WHERE attisdropped = false AND attrelid = (SELECT tbl.oid FROM pg_class tbl LEFT JOIN pg_namespace sch ON tbl.relnamespace = sch.oid WHERE tbl.relkind = 'r'::"char" AND tbl.relname = 'orghead' AND sch.nspname = 'dbo') AND (attname = 'server_id' OR attname = 'orghead_id' OR attname = 'lpu_id' OR attname = 'lpuunit_id' OR attname = 'person_id' OR attname = 'orgheadpost_id' OR attname = 'orghead_phone' OR attname = 'orghead_mobile' OR attname = 'orghead_fax' OR attname = 'orghead_email' OR attname = 'orghead_commissdate' OR attname = 'orghead_commissnum' OR attname = 'orghead_address' OR attname = 'pmuser_insid' OR attname = 'pmuser_updid' OR attname = 'orghead_insdt' OR attname = 'orghead_upddt' OR attname = 'org_id' OR attname = 'orghead_rowversion' OR attname = 'orghead_isrukovod' OR attname = 'orghead_docname' OR attname = 'orghead_docnum' OR attname = 'orghead_docdate' OR attname = 'orghead_rukovodgenetive' OR attname = 'orghead_headpostgenetive')
