cyrilgdn / terraform-provider-postgresql

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

postgresql_tables regexp does not work (anymore?) as it should #397

Open jyriok opened 5 months ago

jyriok commented 5 months ago

Hi there,

Terraform Version

Terraform v1.5.5 on linux_arm64 with latest terraform-provider-postgresql stable version

Affected Resource(s)

Terraform Configuration Files

data "postgresql_tables" "test" {
  database = var.database_db_name                                                                                                                                                                                                                                                       
  schemas = ["public"]
  like_any_patterns = ["%_%"]
}

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

I expect to have the list of application tables (I have 5) in the "public" schema containing "_" in their names.

Actual Behavior

I have in return a list of tables containing "_" but none from my "public" schema, but will list the tables from the "pg_catalog" schema while in the provider it is clearly indicated not to take them:

WHERE schema_name NOT LIKE 'pg_%'

https://github.com/cyrilgdn/terraform-provider-postgresql/blob/a961e75c59b360f901020c612deef1e1da8ecfea/postgresql/data_source_postgresql_schemas.go#L19C1-L19C35