-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Causes "Primary key missing on table" exception when PK doesn't go first in table
| ) k ON (k.attnum = a.attnum) |
Context.
Table:
some-database=# \d someschema.sometable
Table "someschema.sometable"
Column | Type | Collation | Nullable | Default
------------------+-----------------------------+-----------+----------+------------------------------------------
task_id | text | | not null |
input_values | jsonb | | not null |
overlap | integer | | |
infinite_overlap | boolean | | not null |
created | timestamp without time zone | | |
created_at | timestamp with time zone | | not null | now()
id_pool | text | | |
id_project | integer | | |
updated_at | timestamp with time zone | | not null | now()
id | bigint | | not null | nextval('someschema.sometable_id_seq'::regclass)
Indexes:
"sometable_pk" PRIMARY KEY, btree (id)
"sometable_pk_2" UNIQUE CONSTRAINT, btree (task_id)
"idx_sometable__id_pool" btree (id_pool)
"idxw_sometable__id_pool__infinite_overlap" btree (id_pool) WHERE infinite_overlap
"sometable_input_values_content_idx" btree (md5(input_values ->> 'content'::text))
"sometable_input_values_url_gin" gin ((input_values -> 'url'::text))
"sometable_result_matching_result_idx" btree (md5(input_values ->> 'url'::text), md5(input_values ->> 'matching_result'::text))
"sometable_task_id_id_pool_id_project_index" btree (task_id, id_pool, id_project)
"sometable_task_id_id_pool_id_project_input_values_index" btree (task_id, id_pool, id_project, (input_values ->> 'url'::text))
Error:
$ londiste -v some-database.root.ini add-table someschema.sometable
2022-10-24 12:12:11,177 566245 DEBUG Connect 'db' to 'dbname=some-database'
2022-10-24 12:12:11,182 566245 DEBUG exec_query: select * from pgq_node.get_node_info('some-database-londiste')
2022-10-24 12:12:11,194 566245 DEBUG exec_query: select * from pgq_node.get_queue_locations('some-database-londiste')
2022-10-24 12:12:11,195 566245 DEBUG exec_cmd: select * from pgq_node.get_node_info('some-database-londiste')
2022-10-24 12:12:11,197 566245 DEBUG 100 Ok
2022-10-24 12:12:11,197 566245 DEBUG Connect 'provider_db' to 'dbname=some-database'
2022-10-24 12:12:11,208 566245 DEBUG SET LOCAL statement_timeout = 10000
2022-10-24 12:12:11,209 566245 DEBUG exec_cmd: select * from londiste.local_add_table('some-database-londiste', 'someschema.sometable', '[]', null, null)
2022-10-24 12:12:11,215 566245 ERROR Primary key missing on table: someschema.sometable
2022-10-24 12:12:11,215 566245 DEBUG Query was: select * from londiste.local_add_table('some-database-londiste', 'someschema.sometable', '[]', null, null)
2022-10-24 12:12:11,216 566245 ERROR Job some-database.root crashed: db error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/skytools/scripting.py", line 635, in run_func_safely
r = func()
File "/usr/lib/python3/dist-packages/skytools/adminscript.py", line 66, in work
fn(*cmdargs)
File "/usr/lib/python3/dist-packages/londiste/admin.py", line 198, in cmd_add_table
self.add_table(src_db, dst_db, tbl, create_flags, src_tbls)
File "/usr/lib/python3/dist-packages/londiste/admin.py", line 273, in add_table
self.exec_cmd(dst_curs, q, args)
File "/usr/lib/python3/dist-packages/skytools/scripting.py", line 997, in exec_cmd
raise Exception("db error")
Exception: db error
Metadata
Metadata
Assignees
Labels
No labels