422,929 Members | 1,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,929 IT Pros & Developers. It's quick & easy.

Duplicate rows for same primary key in Postgres 9.3.14

P: 1
Normal query for a specific primary key is showing row count as 1. But when trying to fetch the duplicate records in a table (sample command: SELECT name, email, COUNT(*) FROM users GROUP BY name, email HAVING COUNT(*) > 1 ) is showing count as 2 for the same primary key.

Strange thing is after we delete this duplicate record, when we check again for duplicate records, a new row is being displayed with count as 2.

Checked the triggers as well and no new rows being created on delete.

Tried with below options as well:
SET LOCAL enable_indexscan = off;
SET LOCAL enable_bitmapscan = off;
SET LOCAL enable_indexonlyscan = off;

Please let me know if you have come across any similar situation and if any workaround/reason for such situation ?

Thanks in advance!!!
Apr 12 '18 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 921
How is your table 'users' defined?

Can you share the CREATE TABLE statement used to create this table?
Apr 14 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.