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

Converting decimal to numerical value sometimes get truncated (sqlserver -> postgres) #1615

Open
6 tasks done
inoa-dmpassy opened this issue Oct 11, 2024 · 0 comments
Open
6 tasks done

Comments

@inoa-dmpassy
Copy link

inoa-dmpassy commented Oct 11, 2024

  • pgloader --version
pgloader version "3.6.7~devel"
compiled with SBCL 2.1.11.debian
  • did you test a fresh compile from the source tree?

  • did you search for other similar issues?

  • how can I reproduce the bug?

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=YourStrongPassword!"    -p 1433:1433 --name sqlserver    -d mcr.microsoft.com/mssql/server:2022-latest
docker run -d --name postgres_db -e POSTGRES_DB=postgres-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -v postgres_data:/var/lib/postgresql/data postgres:16

Insert data into sqlserver

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[test](
	[some_field] [decimal](28, 13) NOT NULL,
)
GO

INSERT INTO [dbo].[test] ([some_field]) VALUES (-67723280.0928298500000);
LOAD DATABASE
     FROM mssql://alphatools:alphatools@localhost/sqlserver
     INTO postgres://postgres:postgres@localhost:5432/postgres


ALTER SCHEMA 'dbo' RENAME TO 'public'

including only table names like 'test' in schema 'dbo'
;
  • pgloader output you obtain
alphatoolsdmpassy@Desktop-Daniel:~/projects/pgloader$ ./build/bin/pgloader --verbose ~/projects/alphatools-main/load.load 
2024-10-11T18:51:28.010001-03:00 NOTICE Starting pgloader, log system is ready.
2024-10-11T18:51:28.010001-03:00 LOG pgloader version "3.6.70f3557"
2024-10-11T18:51:28.010001-03:00 LOG Data errors in '/tmp/pgloader/'
2024-10-11T18:51:28.010001-03:00 LOG Parsing commands from file #P"/home/dmpassy/projects/alphatools-main/load.load"
2024-10-11T18:51:28.060003-03:00 LOG Migrating from #<MSSQL-CONNECTION mssql://alphatools@localhost:1433/alphatools {100821A8F3}>
2024-10-11T18:51:28.060003-03:00 LOG Migrating into #<PGSQL-CONNECTION pgsql://postgres@localhost:5432/asset {100821B5B3}>
Max connections reached, increase value of TDS_MAX_CONN
2024-10-11T18:51:28.130005-03:00 NOTICE Prepare PostgreSQL database.
2024-10-11T18:51:28.200008-03:00 NOTICE COPY public.portfolio_asset_test with 0 rows estimated [3/4]
Max connections reached, increase value of TDS_MAX_CONN
2024-10-11T18:51:28.230010-03:00 NOTICE DONE copying public.portfolio_asset_test in 0.010s
2024-10-11T18:51:28.240010-03:00 NOTICE Completing PostgreSQL database.
2024-10-11T18:51:28.240010-03:00 NOTICE Reset sequences
2024-10-11T18:51:28.290012-03:00 LOG report summary reset
                 table name     errors       read   imported      bytes      total time       read      write
---------------------------  ---------  ---------  ---------  ---------  --------------  ---------  ---------
            fetch meta data          0          1          1                     0.050s    
             Create Schemas          0          0          0                     0.000s    
           Create SQL Types          0          0          0                     0.010s    
              Create tables          0          2          2                     0.020s    
             Set Table OIDs          0          1          1                     0.000s    
---------------------------  ---------  ---------  ---------  ---------  --------------  ---------  ---------
public.portfolio_asset_test          0          1          1     0.0 kB          0.030s     0.020s     0.010s
---------------------------  ---------  ---------  ---------  ---------  --------------  ---------  ---------
    COPY Threads Completion          0          4          4                     0.030s    
     Index Build Completion          0          0          0                     0.000s    
            Reset Sequences          0          0          0                     0.020s    
               Primary Keys          0          0          0                     0.000s    
        Create Foreign Keys          0          0          0                     0.000s    
            Create Triggers          0          0          0                     0.000s    
           Install Comments          0          0          0                     0.000s    
---------------------------  ---------  ---------  ---------  ---------  --------------  ---------  ---------
          Total import time          ✓          1          1     0.0 kB          0.050s    
  • How the data is different from what you expected, if relevant
    Result: -67723280 instead of -67723280.0928298500000
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

1 participant