cyrilgdn / terraform-provider-postgresql

Terraform PostgreSQL provider
https://www.terraform.io/docs/providers/postgresql/
Mozilla Public License 2.0
356 stars 181 forks source link

simplify the function parsing regex #358

Open tommyzli opened 9 months ago

tommyzli commented 9 months ago

Hello, this is a follow-up to https://github.com/cyrilgdn/terraform-provider-postgresql/pull/307/files

The regex to extract the function attributes relies on pg_get_functiondef to return the attributes in a specific order of IMMUTABLE/STABLE, then PARALLEL SAFE/RESTRICTED, then STRICT, then SECURITY DEFINER. And while the order is preserved across all current versions of Postgres as it is the order generated by the function, I would sleep better at night if these attributes were fetched from the source of truth in pg_proc rather than a regex parser :)