Created
January 15, 2014 16:52
-
-
Save cluesque/8439915 to your computer and use it in GitHub Desktop.
I have a table where I have a row that cannot be found by id. If I go around the PK index, the row is found. If I drop the index, the row is found. If I add a new index, row not found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| d5toqvrtbm8bbu=> SELECT id, created_at FROM widgets WHERE id = 1155301; | |
| id | created_at | |
| ---------+---------------------------- | |
| 1155301 | 2014-01-10 02:59:47.856214 | |
| (1 row) | |
| d5toqvrtbm8bbu=> CREATE UNIQUE INDEX widgets_pkey ON widgets(id); | |
| CREATE INDEX | |
| d5toqvrtbm8bbu=> SELECT id, created_at FROM widgets WHERE id = 1155301; | |
| id | created_at | |
| ----+------------ | |
| (0 rows) | |
| d5toqvrtbm8bbu=> SELECT id, created_at FROM widgets WHERE id - 1 + 1 = 1155301; | |
| id | created_at | |
| ---------+---------------------------- | |
| 1155301 | 2014-01-10 02:59:47.856214 | |
| (1 row) | |
| d5toqvrtbm8bbu=> DROP INDEX widgets_pkey; | |
| DROP INDEX | |
| d5toqvrtbm8bbu=> SELECT id, created_at FROM widgets WHERE id = 1155301; | |
| id | created_at | |
| ---------+---------------------------- | |
| 1155301 | 2014-01-10 02:59:47.856214 | |
| (1 row) | |
| d5toqvrtbm8bbu=> CREATE UNIQUE INDEX widgets_pkey ON widgets(id); | |
| CREATE INDEX | |
| d5toqvrtbm8bbu=> SELECT id, created_at FROM widgets WHERE id = 1155301; | |
| id | created_at | |
| ----+------------ | |
| (0 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment