Opened 5 years ago

Closed 5 years ago

#28116 closed Bug (fixed)

Filtering PostgreSQL exception based on message is too brittle

Reported by: Claude Paroz Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Mariusz Felisiak Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In commit 64264c9a19b7dae6cd1d5e112177cdbcafafc93c, the behavior of _execute_create_test_db depends on the databae error message ''database %s already exists'.

On my system for example, the error message is localized so I'm finally getting a message Got an error creating the test database: la base de données « test_testgis1 » existe déjà even when I provide --keepdb.

Change History (7)

comment:1 Changed 5 years ago by Claude Paroz

Cc: Mariusz Felisiak added

comment:2 Changed 5 years ago by Mariusz Felisiak

Owner: changed from nobody to Mariusz Felisiak
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:3 Changed 5 years ago by Claude Paroz

What about just trying to check if the database exists when keepdb is True?

comment:4 Changed 5 years ago by Mariusz Felisiak

I found a way to check the PostgreSQL error code.

comment:5 Changed 5 years ago by Mariusz Felisiak

Has patch: set

comment:6 Changed 5 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

comment:7 Changed 5 years ago by GitHub <noreply@…>

Resolution: fixed
Status: assignedclosed

In e776dd2d:

Fixed #28116 -- Used error code filtering in PostgreSQL test database creation.

Thanks Claude Paroz and Tim Graham for reviews.

Note: See TracTickets for help on using tickets.
Back to Top