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

Support generated Postgres columns #415

Open
seantalbot-jisc opened this issue Feb 14, 2023 · 0 comments
Open

Support generated Postgres columns #415

seantalbot-jisc opened this issue Feb 14, 2023 · 0 comments
Labels
integration A change which affects or introduces an integration

Comments

@seantalbot-jisc
Copy link

seantalbot-jisc commented Feb 14, 2023

Required Functionality
Synth seems to have trouble with a generated timestamp column.

Proposed Solution
It should ignore the column.

Use case
Relevant postgres schema:

CREATE TABLE
    a_table (
        id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
        created_date TIMESTAMP NOT NULL DEFAULT NOW(),
        updated_date TIMESTAMP NULL
        -- etc.
    );

ALTER TABLE
    a_table 
ADD COLUMN
    last_modified_date TIMESTAMP GENERATED ALWAYS AS (GREATEST(created_date, updated_date)) STORED;

When trying to generate data using synth:

 synth generate --seed 1234  --size 10 --to <uri> testing
...
Error: At namespace "testing"

Caused by:
    0: Failed to insert data for collection a_table
    1: One or more database inserts failed: error returned from database: cannot insert into column "last_modified_date": cannot insert into column "last_modified_date"

Synth version 0.6.9

@iamwacko iamwacko added the integration A change which affects or introduces an integration label Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration A change which affects or introduces an integration
Projects
None yet
Development

No branches or pull requests

2 participants