Postgres 9.4: invalid input syntax for type boolean
See original GitHub issueDatabase: Postgres 9.4.24 Python: 2.7.15 64 bit SQLAlchemy: 1.3.12
SQLAlchemy is generating the following SQL (edited for clarity) which seems to be invalid on this version of Postgres:
SELECT
project_users.id AS project_users_id,
project_users.user_id AS project_users_user_id
FROM
users,
project_users
LEFT OUTER JOIN users AS users_1 ON users_1._id = project_users.user_id
WHERE (project_users.project, users._id = project_users.user_id)
IN(('4c472b93-ead5-ee93-b56e-478cb0bc4dc5', '5b71cfa0d2255300289e4d63'))
The resultant error is:
Query 1 ERROR: ERROR: invalid input syntax for type boolean: "5b71cfa0d2255300289e4d63"
LINE 9: IN(('4c472b93-ead5-ee93-b56e-478cb0bc4dc5', '5b71cfa0d225530...
The python code looks like:
class ProjectUser(BaseModel):
__tablename__ = 'project_users'
id = Column(fields.Integer, primary_key=True, autoincrement=True)
user_id = Column(fields.UID, ForeignKey(User._id), nullable=False)
project = Column(fields.UID, ForeignKey(Project.uid), nullable=False)
user = relationship("User", lazy='select')
class User(BaseModel):
__tablename__ = 'users'
_id = Column(fields.UID, nullable=False)
with read_only_transaction() as session:
query = session.query(ProjectUser)
query = query.options(joinedload(ProjectUser.user))
project_users = query.filter(tuple_(ProjectUser.project, ProjectUser.user).in_(project_user_ids)).all()
What went wrong?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
invalid input syntax for type boolean - Stack Overflow
I'm trying to make a simple update query on postgresql. I don't really understand the error as ...
Read more >PostgreSQL ERROR: invalid input syntax for type boolean
The cause of error: Invalid input syntax for type boolean is when values other than true or false are assigned to an boolean...
Read more >Documentation: 15: 8.6. Boolean Type - PostgreSQL
Boolean constants can be represented in SQL queries by the SQL key words TRUE , FALSE , and NULL . The datatype input...
Read more >483 PostgreSQL boolean type update fails - Adminer
ERROR : invalid input syntax for type boolean: "". in case there are fields of the boolean type set to false . ......
Read more >'invalid input syntax for integer' when importing quoted CSV ...
Coding example for the question PG COPY error: 'invalid input syntax for integer' when importing quoted CSV file without any integers-postgresql.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
the ideal is things like that would work. but the" try it and see if it works, or explodes" is actually what motivates the name “alchemy”. so dust yourself off and try again! 😃
Thanks for helping me catch that… It would be nice to have that support (or an error) eventually, but for now I’m unblocked and at least if anyone else makes this same typo they’ll find this issue and know what they did wrong : )