0

I have inherited Django code that does a migration with a raw SQL query:

INSERT INTO karaage_projectmembership ( ..., is_project_supervisor, ...) SELECT DISTINCT ..., '0', ...

is_project_supervisor is a boolean. The full code is on github.

This works for mysql and sqlite, but breaks with postgresql:

django.db.utils.ProgrammingError: column "is_project_supervisor" is of type boolean but expression is of type text

Looking in the git history, looks like in the past other values were tried but without success on all databases, such as FALSE, 0::bool, 0, 'f', '0'.

Is there any easy way of fixing this? Or do I need to rewrite the SQL to use the Django ORM (suspect this might be less efficient)?

This also has a ticket on github.

Thanks

M.javid
  • 6,387
  • 3
  • 41
  • 56
Penguin Brian
  • 1,991
  • 14
  • 25

0 Answers0