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

greenmask restore fails for generated columns #77

Closed
MamesPalmero opened this issue Apr 25, 2024 · 4 comments · Fixed by #78
Closed

greenmask restore fails for generated columns #77

MamesPalmero opened this issue Apr 25, 2024 · 4 comments · Fixed by #78
Assignees
Labels
bug Something isn't working

Comments

@MamesPalmero
Copy link

MamesPalmero commented Apr 25, 2024

I'm running greenmask reset --config config.yml latest and it fails when trying to restore a table with a generated column. I'm testing without applying transformations to any of the columns of the table that contains the generated column I get the following error message:
FTL fatal error="data stage restoration error: at least one worker exited with error: unable to perform restoration task (worker 4 restoring table \"public\".\"asdfasdf\"): error from postgres connection msg = column \"state\" is a generated column code=42P10"

According to the postgres documentation A generated column cannot be written to directly. In INSERT or UPDATE commands, a value cannot be specified for a generated column, but the keyword DEFAULT may be specified., so I have also tried to apply the following transformation:

dump:
  transformation:
    - schema: 'public'
      name: 'asdfasdf'
      transformers:
        - name: 'Replace'
          params:
            column: 'state'
            value: DEFAULT

but I get the same error message. I only get the restore to work if I ignore the table that has a generated column when doing the dump. I don't know if this is a bug or if greenmask simply doesn't support this type of columns. I hope you will give me the answer.

My specs:

  • Greenmask 0.1.10
  • PostgreSQL 14.11
@wwoytenko wwoytenko self-assigned this Apr 25, 2024
@wwoytenko
Copy link
Contributor

Hi @MamesPalmero! Thank you for reporting. I will explore your issues and get back soon

@wwoytenko
Copy link
Contributor

I've checked your case. So I need to exclude generated columns from COPY statement. I will fix it as soon as possible.

@wwoytenko wwoytenko added the bug Something isn't working label Apr 25, 2024
wwoytenko added a commit that referenced this issue Apr 26, 2024
* Added column attgenerated introspection for pg >= 12 version
* Excluded generated columns from COPY stmnt
@wwoytenko
Copy link
Contributor

Fixed. You can build the main branch manually by calling make build or wait for the next release (expected the next week)

@wwoytenko
Copy link
Contributor

Published in v0.1.11

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