#33854 closed Cleanup/optimization (fixed)

dbshell additional parameters should be passed before dbname on PostgreSQL.

Reported by: Jarrett Keifer Owned by: Jarrett Keifer
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords: psql dbshell
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

psql expects all options to proceed the database name, if provided. So, if doing something like `./manage.py dbshell -- -c "select * from some_table;" one will get this:

$ ./manage.py dbshell -- -c "select * from some_table;"
psql: warning: extra command-line argument "-c" ignored
psql: warning: extra command-line argument "select * from some_table;" ignored
psql (10.21)
Type "help" for help.

some_database=>

It appears the args list just need to be constructed in the proper order, leaving the database name for the end of the args list.

Change History (3)

comment:1 by Mariusz Felisiak, 22 months ago

Owner: changed from nobody to Jarrett Keifer
Status: newassigned
Summary: dbshell additional parameters does not work with psqldbshell additional parameters should be passed before dbname on PostgreSQL.
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

I cannot reproduce these warning with psql (12.11) 🤔, nevertheless I agree that we should pass options as documented.

comment:2 by Mariusz Felisiak, 22 months ago

Triage Stage: AcceptedReady for checkin

comment:3 by GitHub <noreply@…>, 22 months ago

Resolution: fixed
Status: assignedclosed

In 3e3e8141:

Fixed #33854 -- Corrected the order of parameters in dbshell on PostgreSQL.

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