Open staticlibs opened 4 weeks ago
Babelfish gives preference to functions with argument of type INT over VARCHAR when trying to select best function when input values for arguments is of unknown type.
tsql_has_func_args_higher_precedence
tsql_precedence_infos[]
Casting the last argument in regexp_replace()
to TEXT explicitly in sys.replace() to fix the dump restore issue for sys.replace()
seems like the right fix.
@staticlibs: It seems you have use pg_dump directly. Shouldn't you be using bbf_dump?
If I am reading the spec file correctly, bbf_dump
is a pg_dump
built from the postgresql_modified_for_babelfish
tree (without additional patches). In the example above I've used this freshly built pg_dump
modified for Babelfish.
What happened?
With the following T-SQL DB:
If we dump it with
pg_dump
:Then it will fail on restore the following way:
This happens when the data is copied into the following table:
In
sys.replace
the call to regexp_replace for some reason is choosing the following overloaded variant:instead of the expected one:
So it tries to parse string
ig
as an integer and fails on type conversion.As a workaround it is possible to force the correct overload by changing the
regexp_replace
call to the following:But perhaps there exist more general solution to this.
Version
BABEL_4_X_DEV (Default)
Extension
babelfishpg_tsql (Default)
Which flavor of Linux are you using when you see the bug?
Fedora
Relevant log output
Code of Conduct