-
Notifications
You must be signed in to change notification settings - Fork 93
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
[Bug]: BCP cannot import table with time(7) column #3120
Comments
I too experience the same issue in which the |
To clarify, the problem here is not that Babelfish accepts The problem is that when the DDL introspection is used on the column created as There is a workaround that seems to be not too disruptive - to return the type modifier diff --git a/contrib/babelfishpg_tsql/sql/sys_views.sql b/contrib/babelfishpg_tsql/sql/sys_views.sql
index 796ecd34..f917200b 100644
--- a/contrib/babelfishpg_tsql/sql/sys_views.sql
+++ b/contrib/babelfishpg_tsql/sql/sys_views.sql
@@ -149,13 +149,13 @@ BEGIN
WHEN 'date' THEN scale = 0;
WHEN 'datetime' THEN scale = 3;
WHEN 'smalldatetime' THEN scale = 0;
- WHEN 'datetime2' THEN scale = 6;
- WHEN 'datetimeoffset' THEN scale = 6;
+ WHEN 'datetime2' THEN scale = 7;
+ WHEN 'datetimeoffset' THEN scale = 7;
WHEN 'decimal' THEN scale = 38;
WHEN 'numeric' THEN scale = 38;
WHEN 'money' THEN scale = 4;
WHEN 'smallmoney' THEN scale = 4;
- WHEN 'time' THEN scale = 6;
+ WHEN 'time' THEN scale = 7;
WHEN 'tinyint' THEN scale = 0;
ELSE
IF return_null_for_rest This can be applied manually to existing DB cluster by recreating |
What happened?
Using the latest
bcp
utility:And the table in MSSQL like this:
This table is exported from MSSQL using the native binary format:
The same table is created in Babelfish, the type modifier for
col1
is saved in a catalog as "unspecified":And
sp_describe_first_result_set
returns type modifier6
for this column:When we try to import into Babelfish that
tab1.bcp
file exported from MSSQL, the following error occurs:The
bcp
utility usessp_describe_first_result_set
to get column types for the specified table. Based on its return it generates the following bulk copy query:And the error happens on the client side in ODBC driver when it tries to bind the
time(7)
value from the input file to thetime(6)
parameter.It is unclear how to approach this problem on server side (perhaps the unused
7
type modifier can be retained inattoptions
catalog field?). And AFAIU there are no workarounds to this on client side (withbcp
) for binary files exported from MSSQL which containtime(7)
ordatetime2(7)
columns.Version
BABEL_4_X_DEV (Default)
Extension
None
Which flavor of Linux are you using when you see the bug?
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: