PostgresqlMetadata Retrieve trigger throw exception
Opened this issue · 5 comments
Bug Report
Incorrect column parameters when retrieving trigger info in sql
Q | A |
---|---|
Version(s) | 2.15.1 |
PostgreSQL | 10.21 |
Summary
Incorrect column parameters when retrieving trigger info in sql
Sql produce by PostgresqlMetadata loadTriggerData()
SELECT "trigger_name",
"event_manipulation",
"event_object_catalog",
"event_object_schema",
"event_object_table",
"action_order",
"action_condition",
"action_statement",
"action_orientation",
"condition_timing" "action_timing",
"condition_reference_old_table" "action_reference_old_table",
"condition_reference_new_table" "action_reference_new_table",
"created"
FROM "information_schema"."triggers" WHERE "trigger_schema" = 'public'
condition_timing should be the alias of action_timing
condition_reference_old_table should be the alias of action_reference_old_table
condition_reference_new_table should be the alias of action_reference_new_table
Current behavior
Exception Thrown
PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column "condition_timing" does not exist
LINE 1: ...ition", "action_statement", "action_orientation", "condition...
How to reproduce
$adapter = new Adapter([
'driver' => 'Pdo_Pgsql',
'hostname' => 'localhost',
'port' => 5432,
'username' => 'postgres',
'password' => '888888',
'database' => 'postgres'
]);
$metadata = Factory::createSourceFromAdapter($adapter);
$metadata->getTriggers();
Expected behavior
Should produce this sql
SELECT "trigger_name",
"event_manipulation",
"event_object_catalog",
"event_object_schema",
"event_object_table",
"action_order",
"action_condition",
"action_statement",
"action_orientation",
"action_timing" "condition_timing",
"action_reference_old_table" "condition_reference_old_table",
"action_reference_new_table" "condition_reference_new_table",
"created"
FROM "information_schema"."triggers"
WHERE "trigger_schema" = 'public'
Ia this also applicable to previous versions?
Ia this also applicable to previous versions?
test on latest version 9 also not working, I don't think anybody use lower then 9
Run using docker
docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=888888 postgres:9
I haven't check previous laminas-db version
Sorry, I mean lower versions of this library 😁
2.13
2.14
2.15
does not work return same exception
Thanks for verifying: was just trying to understand if this was a regression 👍