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

Empty strings get stored as null #68

Open
tombriggsallego opened this issue Feb 10, 2022 · 1 comment · May be fixed by #69
Open

Empty strings get stored as null #68

tombriggsallego opened this issue Feb 10, 2022 · 1 comment · May be fixed by #69
Labels
bug Something isn't working

Comments

@tombriggsallego
Copy link

Describe the bug
An incoming value of "" gets sent to the database as NULL. In most cases this isn't a big deal (though it's not technically correct...) but we have a table where a field containing empty strings is part of the PK, so the value sent to Postgres can't be NULL. (Our source in this case is MySQL but I don't think that actually matters.)

To Reproduce
Steps to reproduce the behavior:

  1. Create a table in MySQL with a varchar not null in the PK, e.g.
CREATE TABLE EmptyStringTest (x int NOT NULL, y varchar(10) NOT NULL, PRIMARY KEY (x,y))
  1. Add a row where the varchar column in the PK is the empty string
INSERT INTO EmptyStringTest VALUES(1, '')
  1. Setup and run a pipeline from MySQL to Postgres
  2. Execution will fail with a "column cannot be null" error

This doesn't seem to be a problem with columns that are not part of a PK as they seem to be created as nullable in the target even if they're declared NOT NULL in the source.

Expected behavior
The value inserted in PG should be an empty string

Environment

  • Version of target: github latest
  • Version of python 3.8
  • Meltano latest
@tombriggsallego tombriggsallego added the bug Something isn't working label Feb 10, 2022
@tombriggsallego tombriggsallego linked a pull request Feb 10, 2022 that will close this issue
13 tasks
@ebennett-fevo
Copy link

Having this same issue, wondering if this will be merged

msg555 added a commit to weavegrid/pipelinewise-target-postgres that referenced this issue Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants