← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1543382] [NEW] DBError (psycopg2.ProgrammingError) operator does not exist: character varying = text[]

 

Public bug reported:

Opening a new bug based on a comment from another bug:

https://bugs.launchpad.net/nova/+bug/1518200/comments/6

There appears to be a problem with postgres queries using the in_
operator for example:

  query = query.filter(models.Migration.status.in_(status))

where status is an array of strings like ['accepted', 'done'].

The error:

 DBError: (psycopg2.ProgrammingError) operator does not exist: character varying = text[]
 LINE 3: ...HERE migrations.deleted = 0 AND migrations.status = ARRAY['a...
 HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

looks to be about the fact that the "status" column of the Migration
table is of type varchar whereas the array for the IN operator is
defaulting to being treated as an array of text types, and that an
explicit cast is needed.

I didn't find any existing type casting and we do have a number of
similar queries already of style "column.in_(array of strings)" so I
wonder if this is a problem for all such queries, and not just this
migration status example one.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: db postgresql

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1543382

Title:
  DBError (psycopg2.ProgrammingError) operator does not exist: character
  varying = text[]

Status in OpenStack Compute (nova):
  New

Bug description:
  Opening a new bug based on a comment from another bug:

  https://bugs.launchpad.net/nova/+bug/1518200/comments/6

  There appears to be a problem with postgres queries using the in_
  operator for example:

    query = query.filter(models.Migration.status.in_(status))

  where status is an array of strings like ['accepted', 'done'].

  The error:

   DBError: (psycopg2.ProgrammingError) operator does not exist: character varying = text[]
   LINE 3: ...HERE migrations.deleted = 0 AND migrations.status = ARRAY['a...
   HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

  looks to be about the fact that the "status" column of the Migration
  table is of type varchar whereas the array for the IN operator is
  defaulting to being treated as an array of text types, and that an
  explicit cast is needed.

  I didn't find any existing type casting and we do have a number of
  similar queries already of style "column.in_(array of strings)" so I
  wonder if this is a problem for all such queries, and not just this
  migration status example one.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1543382/+subscriptions