bytebase / bytebase

The GitHub/GitLab for database DevSecOps. World's most advanced database DevSecOps solution for Developer, Security, DBA and Platform Engineering teams.
https://www.bytebase.com
Other
11.53k stars 739 forks source link

PostgreSQL error on Sync Schema (functions/procedures) #13819

Open Lautaro-Castillo opened 2 months ago

Lautaro-Castillo commented 2 months ago

Provide the Bytebase version you are using

2.23.0

Describe the bug

When we try to synchronize schemas between PostgreSQL14 databases the procedures are recognized as functions in the generated DDL statement. Example: We have created the procedure process.create_data(boolean,varchar) but the “Generated DDL statement” tab shows: DROP FUNCTION “process”. “create_data"(boolean, varchar);

CREATE PROCEDURE process.create_data(IN p_full boolean, IN p_data character).

Then we get the following error: failed to execute context in a transaction: ERROR: process.create_data(boolean,varchar) is not a function (SQLSTATE 42809)

Indeed, it is not a function, but the DDL is wrong, we can fix it manually by writing “DROP PROCEDURE” instead of “DROP FUNCTION”.

Steps to reproduce

Create a procedure in PostgreSQL database Sync Schema with another PostgreSQL database Produced DDL statement is wrong and the procedure is recognized as a function

Expected behavior

Produced DDL statement is correct and procedures are recognized as procedures.

Provide the database you are using

PostgreSQL 14

Provide the version control system you are using

No response

Additional context

No response

d-bytebase commented 3 weeks ago

@h3n4l should have fixed the issue which comes from underlying dependency library. The next release should come with the change.