Quote Postgres names to avoid implicit conversion

Bug #1412568 reported by Petr Malik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Medium
Petr Malik

Bug Description

In PostgreSQL unquoted names are case-insensitive. However, quoted names are case-sensivite.
Unquoted names are implicitly lowercased!

Trove guestagent currently uses unquoted names leading to inproper behavior when the user actually uses names with uppercase letters.

Example:
trove user-create <id> USERNAME <password>
trove user-show <id> USERNAME

results in a 404 error - user not found on instance, because the user created is actually "username".

Tags: postgresql
Petr Malik (pmalik)
Changed in trove:
assignee: nobody → Petr Malik (pmalik)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to trove (master)

Fix proposed to branch: master
Review: https://review.openstack.org/148378

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to trove (master)

Reviewed: https://review.openstack.org/148378
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=9ee427d43f0f8a424751e56fc1e62a0633cdc0e9
Submitter: Jenkins
Branch: master

commit 9ee427d43f0f8a424751e56fc1e62a0633cdc0e9
Author: Petr Malik <email address hidden>
Date: Mon Jan 19 17:41:05 2015 -0500

    Quote Postgres names to avoid implicit conversion

    In PostgreSQL unquoted names are case-insensitive.
    However, quoted names are case-sensivite.
    Unquoted names are implicitly lowercased!

    Problem:
    Trove guestagent currently uses unquoted names leading to
    inproper behavior when the user actually uses names
    with uppercase letters.

    Example:
    trove user-create <id> USERNAME <password>
    trove user-show <id> USERNAME

    results in a 404 error - user not found on instance,
    because the user created is actually "username".

    Solution:
    Make sure we quote user provided names and value strings in
    SQL statements in 'guestagent/datastore/postgresql/pgutil.py'.

    Change-Id: I5f86b2b0c0195aafb436a65da03d66e4ff2bf9d6
    Closes-bug: 1412568

Changed in trove:
status: In Progress → Fix Committed
Changed in trove:
importance: Undecided → Medium
milestone: none → kilo-2
Thierry Carrez (ttx)
Changed in trove:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in trove:
milestone: kilo-2 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.