Skip to content

Commit

Permalink
Merge pull request #561 from vitorbaptista/542-postgres-lt9.1-has-no-…
Browse files Browse the repository at this point in the history
…left

[#542] Remove usage of postgres' function that's not available in < 9.1
  • Loading branch information
vitorbaptista committed Mar 5, 2013
2 parents 6e990b3 + c030bf4 commit 198fe26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ckan/migration/versions/067_turn_extras_to_strings.py
Expand Up @@ -7,7 +7,7 @@ def upgrade(migrate_engine):
revision_tables = 'package_extra_revision group_extra_revision'

for table in tables.split():
sql = """select id, value from {table} where left(value,1) = '"' """.format(table=table)
sql = """select id, value from {table} where substr(value,0,1) = '"' """.format(table=table)
results = connection.execute(sql)
for result in results:
id, value = result
Expand All @@ -16,7 +16,7 @@ def upgrade(migrate_engine):
json.loads(value), id)

for table in revision_tables.split():
sql = """select id, revision_id, value from {table} where left(value,1) = '"' """.format(table=table)
sql = """select id, revision_id, value from {table} where substr(value,0,1) = '"' """.format(table=table)

results = connection.execute(sql)
for result in results:
Expand Down

0 comments on commit 198fe26

Please sign in to comment.