postgresml/pgcat

wrong startup message

Closed this issue · 2 comments

environment
os: ubuntu
pgcat version: 1.1.1 / 1.1.2-dev
postgresql: 15.4

I added plugin configuration to pgcat.toml file.
The plugin state is all false . (enabled = false)

----------------- pgcat.toml ------------------------------------------

# Default plugins that are configured on all pools.
[plugins]

# Prewarmer plugin that runs queries on server startup, before giving the connection
# to the client.
[plugins.prewarmer]
enabled = false                                              # false !!!
queries = [
  "SELECT pg_prewarm('pgbench_accounts')",
]

# Log all queries to stdout.
[plugins.query_logger]
enabled = false                                                         # false !!!

# Block access to tables that Postgres does not allow us to control.
[plugins.table_access]
enabled = false
tables = [
  "pg_user",
  "pg_roles",
  "pg_database",
]

# Intercept user queries and give a fake reply.
[plugins.intercept]
enabled = false                                                                # false !!!

[plugins.intercept.queries.0]

query = "select current_database() as a, current_schemas(false) as b"
schema = [
  ["a", "text"],
  ["b", "text"],
]
result = [
  ["${DATABASE}", "{public}"],
]

[plugins.intercept.queries.1]

query = "select current_database(), current_schema(), current_user"
schema = [
  ["current_database", "text"],
  ["current_schema", "text"],
  ["current_user", "text"],
]
result = [
  ["${DATABASE}", "public", "${USER}"],
]

------------------ startup message ---------------

root@1daa72ca34b1:/etc/pgcat# pgcat
2023-08-24T06:27:27.667818Z  INFO pgcat: Welcome to PgCat! Meow. (Version 1.1.2-dev)    
2023-08-24T06:27:27.671550Z  INFO pgcat: Running on 0.0.0.0:2432    
2023-08-24T06:27:27.671581Z  INFO pgcat::config: Ban time: 60s    
2023-08-24T06:27:27.671587Z  INFO pgcat::config: Idle client in transaction timeout: 0ms    
2023-08-24T06:27:27.671591Z  INFO pgcat::config: Worker threads: 4    
2023-08-24T06:27:27.671596Z  INFO pgcat::config: Healthcheck timeout: 1000ms    
2023-08-24T06:27:27.671601Z  INFO pgcat::config: Connection timeout: 5000ms    
2023-08-24T06:27:27.671605Z  INFO pgcat::config: Idle timeout: 600000ms    
2023-08-24T06:27:27.671610Z  INFO pgcat::config: Log client connections: false    
2023-08-24T06:27:27.671615Z  INFO pgcat::config: Log client disconnections: false    
2023-08-24T06:27:27.671619Z  INFO pgcat::config: Shutdown timeout: 60000ms    
2023-08-24T06:27:27.671623Z  INFO pgcat::config: Healthcheck delay: 30000ms    
2023-08-24T06:27:27.671627Z  INFO pgcat::config: Default max server lifetime: 3600000ms    
2023-08-24T06:27:27.671632Z  INFO pgcat::config: Sever round robin: true    
2023-08-24T06:27:27.671636Z  INFO pgcat::config: TLS support is disabled    
2023-08-24T06:27:27.671641Z  INFO pgcat::config: Server TLS enabled: false    
2023-08-24T06:27:27.671645Z  INFO pgcat::config: Server TLS certificate verification: false    
2023-08-24T06:27:27.671651Z  INFO pgcat::config: Prepared statements: false    

??????????????? why true not false?
2023-08-24T06:27:27.671657Z  INFO pgcat::config: Plugins: interceptor: true, table_access: true, query_logger: true, prewarmer: true      <----- why true not false?
???????????????

2023-08-24T06:27:27.671664Z  INFO pgcat::config: [pool: postgres] Maximum user connections: 9    
2023-08-24T06:27:27.671669Z  INFO pgcat::config: [pool: postgres] Default pool mode: transaction 


I can't replicate this with latest codebase, is it still relevant?

I can confirm that this can be closed. Code was changed when adding plugin Trait.

Previous behaviour did have a bug:

      self.intercept.is_some(),
      self.table_access.is_some(),
      self.query_logger.is_some(),
      self.prewarmer.is_some(),

This old code would return true if config existed and did not report the actual enabled value.