anon.lorem_ipsum(characters := length(foo.bar)) is not a valid masking function

I noticed that dynamic length determination of strings no longer seems to work after an update from PostgreSQL Anonymizer version 1.1 to 1.3.

Steps to reproduce:

  1. I used the following Docker image:
FROM postgres:16
RUN apt-get update && \
    apt-get install -y build-essential pgxnclient postgresql-server-dev-16 && \
    pgxn install postgresql_anonymizer
docker build -f Dockerfile -t db:latest .
docker run --detach --name db --env POSTGRES_PASSWORD='bonjour' db:latest
docker exec -it db psql -U postgres
  1. Initialize the PostgreSQL Anonymizer extension
  2. CREATE TABLE foo (bar VARCHAR(20));
  3. SECURITY LABEL FOR anon ON COLUMN foo.bar IS 'MASKED WITH FUNCTION anon.lorem_ipsum(characters := LENGTH(foo.bar))';

The error message displayed is

ERROR: 'MASKED WITH FUNCTION anon.lorem_ipsum(characters := LENGTH(foo.bar))' is not a valid masking function

I used the masking function anon.random_string(LENGTH(foo.bar)), which worked in version 1.1, although it is not a documented feature.

Thanks for your time!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information