servicedesk=# servicedesk=# select version(); version ------------------------------------------------------------- PostgreSQL 9.2.4, compiled by Visual C++ build 1600, 64-bit (1 row) Time: 0.541 ms servicedesk=# \d+ usernotifications; Table "public.usernotifications" Column | Type | Modifiers | Storage | Stats target | Description -----------------------+---------+------------------------+---------+--------------+------------- dynamicnotificationid | bigint | not null | plain | | userid | bigint | not null | plain | | isread | boolean | not null default false | plain | | Indexes: "usernotifications_pk" PRIMARY KEY, btree (dynamicnotificationid, userid) "usernotifications_dynamicnotificationid_idx" UNIQUE, btree (dynamicnotificationid) "usernotifications_fk1_idx" btree (dynamicnotificationid) "usernotifications_fk2_idx" btree (userid) Foreign-key constraints: "usernotifications_fk1" FOREIGN KEY (dynamicnotificationid) REFERENCES dynamicnotifications(dynamicnotificationid) ON DELETE CASCADE "usernotifications_fk2" FOREIGN KEY (userid) REFERENCES sduser(userid) ON DELETE CASCADE Has OIDs: no servicedesk=# \d+ dynamicnotifications Table "public.dynamicnotifications" Column | Type | Modifiers | Storage | Stats target | Description -----------------------+--------+-----------+----------+--------------+------------- dynamicnotificationid | bigint | not null | plain | | module | citext | not null | extended | | moduleid | bigint | not null | plain | | notify_type | citext | not null | extended | | notify_time | bigint | not null | plain | | ownerid | bigint | | plain | | Indexes: "dynamicnotifications_pk" PRIMARY KEY, btree (dynamicnotificationid) "dynamicnotifications_dynamicnotificationid_idx" UNIQUE, btree (dynamicnotificationid) "dynamicnotifications_ownerid_idx" btree (ownerid) Check constraints: "dynamicnotifications_module_c" CHECK (length(module::text) <= 200) "dynamicnotifications_notify_type_c" CHECK (length(notify_type::text) <= 200) Referenced by: TABLE "usernotifications" CONSTRAINT "usernotifications_fk1" FOREIGN KEY (dynamicnotificationid) REFERENCES dynamicnotifications(dynamicnotificationid) ON DELETE CASCADE Has OIDs: no servicedesk=# servicedesk=# servicedesk=# alter table usernotifications validate constraint usernotifications_fk1; ALTER TABLE Time: 1.135 ms servicedesk=# select ctid,xmin,xmax, * from dynamicnotifications where dynamicnotificationid = 1054486; ctid | xmin | xmax | dynamicnotificationid | module | moduleid | notify_type | notify_time | ownerid ------+------+------+-----------------------+--------+----------+-------------+-------------+--------- (0 rows) Time: 0.897 ms servicedesk=# select ctid,xmin,xmax, * from usernotifications where dynamicnotificationid = 1054486; ctid | xmin | xmax | dynamicnotificationid | userid | isread -----------+--------+------+-----------------------+--------+-------- (6701,98) | 868387 | 0 | 1054486 | 4 | f (1 row) Time: 0.606 ms servicedesk=#