tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
381 stars 102 forks source link

problem with data type "fload(0)" #343

Closed JosefMachytkaNetApp closed 1 year ago

JosefMachytkaNetApp commented 1 year ago

Issue report

I am testing migration of Sybase (15.7) data into PostgreSQL (15.4) using TDS_FDW and when running IMPORT FOREIGN SCHEMA, some tables fail because they contain column with data type "float(0)" - really size ZERO, see below in error output. I must exclude such a table from schema import and add manual creation of it with some non-zero size of float type. Is there some way to avoid this error and set some default size for float data in case size is 0? I so far did not find any mention of this problem on web, if there is already some solution, please give me a link. Thank you very much.

Operating system

Ubuntu 20

Version of tds_fdw

tds_fdw | 2.0.3

Version of PostgreSQL

15.4

Version of FreeTDS

ii freetds-bin 1.1.6-1.1 amd64 FreeTDS command-line utilities ii freetds-common 1.1.6-1.1 all configuration files for FreeTDS SQL client libraries ii freetds-dev 1.1.6-1.1 amd64 MS SQL and Sybase client library (static libs and headers)

Logs

postgres=# IMPORT FOREIGN SCHEMA dbo FROM SERVER sybase_pubs3 INTO pubs3_sybase OPTIONS (import_default 'false'); NOTICE: DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'master'. , Server: DKSYBASE, Process: , Line: 0, Level: 10 NOTICE: DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed database context to 'pubs3'. , Server: DKSYBASE, Process: , Line: 1, Level: 10 ERROR: precision for type float must be at least 1 bit LINE 6: discount float(0) OPTIONS (column_name 'discount') NOT NUL... ^ QUERY: CREATE FOREIGN TABLE salesdetail ( stor_id char(4) OPTIONS (column_name 'stor_id') NOT NULL, ord_num numeric(6) OPTIONS (column_name 'ord_num') NOT NULL, title_id text OPTIONS (column_name 'title_id') NOT NULL, qty smallint OPTIONS (column_name 'qty') NOT NULL, discount float(0) OPTIONS (column_name 'discount') NOT NULL ) SERVER sybase_pubs3 OPTIONS (schema_name 'dbo', table_name 'salesdetail');

Sentences, data structures, data

JosefMachytkaNetApp commented 1 year ago

due to the error on connection imported repeatedly, I am sorry