Skip to content
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

In new version 2.3.0 have error with triggers functions #306

Closed
Victor1995fed opened this issue Jul 5, 2022 · 7 comments
Closed

In new version 2.3.0 have error with triggers functions #306

Victor1995fed opened this issue Jul 5, 2022 · 7 comments

Comments

@Victor1995fed
Copy link

PGSync version: 2.3.0

Postgres version: 14.1

Elasticsearch version: 8.3

Redis version:

Python version: 3.7

Problem Description:
In new version have error
In old versions all work fine
I am find problem in function drop_function (base.py)
Please, fix it
image_2022-07-05_15-42-38

Error Message (if any):

e, statement, parameters, cursor, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2044, in _handle_dbapi_exception sqlalchemy_exception, with_traceback.exc_info[2], from_=e File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1820, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.InternalError: (psycopg2.errors.DependentObjectsStillExist) cannot drop function table_notify() because other objects depend on it DETAIL: trigger mnn_notify on table mnn depends on function table_notify() trigger mnn_truncate on table mnn depends on function table_notify() trigger country_notify on table country depends on function table_notify() trigger country_truncate on table country depends on function table_notify() trigger producer_notify on table producer depends on function table_notify() trigger producer_truncate on table producer depends on function table_notify() trigger popular_product_count_notify on table popular_product_count depends on function table_notify() trigger popular_product_count_truncate on table popular_product_count depends on function table_notify() trigger promoter_notify on table promoter depends on function table_notify() trigger promoter_truncate on table promoter depends on function table_notify() trigger grouping_notify on table "grouping" depends on function table_notify() trigger grouping_truncate on table "grouping" depends on function table_notify() trigger product_mnn_notify on table product_mnn depends on function table_notify() trigger product_mnn_truncate on table product_mnn depends on function table_notify() trigger category_notify on table category depends on function table_notify() trigger category_truncate on table category depends on function table_notify() trigger product_image_notify on table product_image depends on function table_notify() trigger product_image_truncate on table product_image depends on function table_notify() trigger product_offers_notify on table product_offers depends on function table_notify() trigger product_offers_truncate on table product_offers depends on function table_notify() trigger brand_notify on table brand depends on function table_notify() trigger brand_truncate on table brand depends on function table_notify() trigger dosage_notify on table dosage depends on function table_notify() trigger dosage_truncate on table dosage depends on function table_notify() trigger product_category_notify on table product_category depends on function table_notify() trigger product_category_truncate on table product_category depends on function table_notify() trigger product_notify on table product depends on function table_notify() trigger product_truncate on table product depends on function table_notify() trigger offers_notify on table offers depends on function table_notify() trigger offers_truncate on table offers depends on function table_notify() trigger product_cluster_notify on table product_cluster depends on function table_notify() trigger product_cluster_truncate on table product_cluster depends on function table_notify() trigger cluster_notify on table cluster depends on function table_notify() trigger cluster_truncate on table cluster depends on function table_notify() HINT: Use DROP ... CASCADE to drop the dependent objects too. 
[SQL: DROP FUNCTION IF EXISTS "public".table_notify()] [parameters: (None,)] (Background on this error at: https://sqlalche.me/e/14/2j85) root@io:/home/dv# 

@toluaina
Copy link
Owner

toluaina commented Jul 5, 2022

  • Did you by any chance add/remove to/from the schema.json ?
  • It seems your schema.json is out of sync with what is actually in your database.
  • Normally you'd need re-run bootstrap if you edit schema.json
  • In any case, you should be able to resolve this by running
    • bootstrap -c schema.json -t
    • bootstrap -c schema.json

@Victor1995fed
Copy link
Author

After run bootstrap -c schema.json -t or bootstrap -c schema.json I get same error
Than I run "DROP FUNCTION table_notify() CASCADE;" in sql terminal, but it didn't help too
I am drop all replication slots in pgsql from sql terminal pg_drop_replication_slot, but it didn't help again
All worked fine only after downgrade version to 2.2.1
I suppose problem in drop_function and if add to it CASCADE all will work correct
Maybe I am wrong but I haven't any other idea

@huytxx
Copy link

huytxx commented Jul 6, 2022

ảnh

ảnh

i have same error when i have two index

@huytxx
Copy link

huytxx commented Jul 7, 2022

ảnh

it still doesn't seem to work in my case,i removed the table_notify() trigger manually, and restarted my db, but it still doesn't work

@toluaina
Copy link
Owner

toluaina commented Jul 7, 2022

Can you try now. just published a new version with this fix.

@huytxx
Copy link

huytxx commented Jul 7, 2022

it worked for my case, thanks for your support

@toluaina
Copy link
Owner

thank you all. Closing this as resolved.

Zurnaz pushed a commit to Zurnaz/pgsync that referenced this issue Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants