ankane/pgsync

Question: `statement` executes once and applied to all rows on a table?

NominalTrajectory opened this issue · 2 comments

Hi,

I'm using this project in combination with https://gitlab.com/dalibo/postgresql_anonymizer

And I have this in my .pgsync.yml:

data_rules:
  # Sanitize Bank Accounts
  bank_accounts.iban:
    statement: "(SELECT anon.fake_iban() AS iban)"

What I see in the end is that the same output is applied to all rows:

image


Is it possible to make the statement execute for each row?

Hi @NominalTrajectory, this is due to the statement being a subquery. Instead, use:

statement: "anon.fake_iban()"

@ankane Ah, that worked. Thanks a lot!