New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incomplete PostgreSQL schema when syncing from a user with privs on specific tables only #105
Comments
Looks like the same problem with PK serial fields. Source:
Target:
|
What KS version, PG version, and OS? |
KS v2.11, PG source v11 (google managed), PG target v12 (google managed), OS: debian:10 (docker) |
When I run the above statements in psql and then look at the output, only the source has a primary key; the target doesn't. So the two schemas don't match, and KS recreates the table to make them match. You need to have the same schema at each end to use KS to sync data. If you don't, it changes the schema first to make them match. If the PK doesn't match, this involves recreating the table. It only needs to do this once; after that, it syncs correctly. eg. for the second examples you gave above:
|
Are you seeing different behavior to the above with Google Cloud SQL? |
Wait, I get this for the first example - note that my output does have a PRIMARY KEY, whereas yours doesn't. My source table doesn't have the other constraints (because I don't have those tables), though.
|
Added the other tables (just dummy tables with the id column) so that I can create the other constraints. It still works OK locally (pg 13.3). I guess I'll try and create some Cloud SQL instances.
|
That works fine for me too, so I can't reproduce the issue @RostislavKonstantinov :|. Created these two instances: Pasted the above SQL into the first, then ran:
|
Hi @willbryant. Thank you for your investigation. I didn't have time today for an answer, sorry. |
Also, I will try collecting more information for you, it needs time. |
@willbryant I understood that I used read-only user in source DB and it was a problem. When I changed the user everything is working fine. Outcome: wrong permissions for user in the source-db. Feel free to close the issue and thank you for your time and responsiveness! As a little improvement, KS could have been informing about not enough permissions.) |
Ah! That's very interesting. I don't know why that happens. Maybe it does not have enough permissions to read some of the schema information tables, so it misses some schema objects like keys? How do I create a read-only user to match yours? |
My user have only
|
Looks like this user was created mannualy from psql (by my colleague) and was granted only to existing tables in source schema. |
https://cloud.google.com/sql/docs/postgres/create-manage-users#creating |
I've never been able to figure out how to reproduce this one. If I revoke default permissions eg. It must be possible somehow, I'm just not sure how. Perhaps there's something special about the Google Cloud SQL permission model, but nothing sticks out to me in the docs. No-one else has run into this in the meantime, so I'll close it for now as suggested. If anyone has exact steps to set up the situation, definitely happy to reopen and work on it. |
I have PG->PG synchronization process. Some of my tables use varchar as a primary key. When I run synchronization process through the kitchen-sync I have no error but:
Clearing and reloading orchestra_vm, can't efficiently detect differences because it has no primary key and no other suitable keys.
Source table:
Destination table (created by kitchen-sync):
Logs:
The text was updated successfully, but these errors were encountered: