Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in Postgresql with empty last_modified #1305

Closed
leplatrem opened this issue Aug 2, 2017 · 1 comment
Closed

Crash in Postgresql with empty last_modified #1305

leplatrem opened this issue Aug 2, 2017 · 1 comment

Comments

@leplatrem
Copy link
Contributor

The last_modified value is supposed to be validated before reaching the backend...

(psycopg2.DataError) invalid input syntax for integer: ""
LINE 7:                AND as_epoch(last_modified) > ''
                                                     ^
 [SQL: '\n        WITH total_filtered AS (\n            SELECT COUNT(id) AS count\n              FROM records\n             WHERE parent_id = %(parent_id)s\n               AND collection_id = %(collection_id)s\n               AND as_epoch(last_modified) > %(filters_value_0)s\n        ),\n        collection_filtered AS (\n            SELECT id, last_modified, data\n              FROM records\n             WHERE parent_id = %(parent_id)s\n               AND collection_id = %(collection_id)s\n               AND as_epoch(last_modified) > %(filters_value_0)s\n        ),\n        fake_deleted AS (\n            SELECT (%(deleted_field)s)::JSONB AS data\n        ),\n        filtered_deleted AS (\n            SELECT id, last_modified, fake_deleted.data AS data\n              FROM deleted, fake_deleted\n             WHERE parent_id = %(parent_id)s\n               AND collection_id = %(collection_id)s\n               AND as_epoch(last_modified) > %(filters_value_0)s\n               \n        ),\n        all_records AS (\n            SELECT * FROM filtered_deleted\n             UNION ALL\n            SELECT * FROM collection_filtered\n        ),\n        paginated_records AS (\n            SELECT DISTINCT id\n              FROM all_records\n              \n        )\n        SELECT total_filtered.count AS count_total,\n               a.id, as_epoch(a.last_modified) AS last_modified, a.data\n          FROM paginated_records AS p JOIN all_records AS a ON (a.id = p.id),\n               total_filtered\n          ORDER BY last_modified DESC, last_modified DESC\n          LIMIT %(pagination_limit)s;\n        '] [parameters: {'deleted_field': '{"deleted":true}', 'collection_id': 'record', 'parent_id': '/buckets/blocklists/collections/addons', 'filters_value_0': '', 'pagination_limit': 10000}]
@leplatrem
Copy link
Contributor Author

(psycopg2.DataError) invalid input syntax for integer: ""
LINE 7: ...onfirm(65534)' = '["",""]') AND as_epoch(last_modified) > ''
                                                                     ^
 [SQL: '\n        WITH total_filtered AS (\n            SELECT COUNT(id) AS count\n              FROM records\n             WHERE parent_id = %(parent_id)s\n               AND collection_id = %(collection_id)s\n               AND (data->%(filters_field_0_0)s IS NOT NULL AND data->%(filters_field_0_0)s = %(filters_value_0)s) AND as_epoch(last_modified) > %(filters_value_1)s\n        ),\n        collection_filtered AS (\n            SELECT id, last_modified, data\n              FROM records\n             WHERE parent_id = %(parent_id)s\n               AND collection_id = %(collection_id)s\n               AND (data->%(filters_field_0_0)s IS NOT NULL AND data->%(filters_field_0_0)s = %(filters_value_0)s) AND as_epoch(last_modified) > %(filters_value_1)s\n        ),\n        fake_deleted AS (\n            SELECT (%(deleted_field)s)::JSONB AS data\n        ),\n        filtered_deleted AS (\n            SELECT id, last_modified, fake_deleted.data AS data\n              FROM deleted, fake_deleted\n             WHERE parent_id = %(parent_id)s\n               AND collection_id = %(collection_id)s\n               AND (data->%(filters_field_0_0)s IS NOT NULL AND data->%(filters_field_0_0)s = %(filters_value_0)s) AND as_epoch(last_modified) > %(filters_value_1)s\n               \n        ),\n        all_records AS (\n            SELECT * FROM filtered_deleted\n             UNION ALL\n            SELECT * FROM collection_filtered\n        ),\n        paginated_records AS (\n            SELECT DISTINCT id\n              FROM all_records\n              \n        )\n        SELECT total_filtered.count AS count_total,\n               a.id, as_epoch(a.last_modified) AS last_modified, a.data\n          FROM paginated_records AS p JOIN all_records AS a ON (a.id = p.id),\n               total_filtered\n          ORDER BY last_modified DESC\n          LIMIT %(pagination_limit)s;\n        '] [parameters: {'collection_id': 'record', 'filters_field_0_0': 'confirm(65534)', 'pagination_limit': 10000, 'parent_id': '/buckets/blocklists/collections/plugins', 'filters_value_1': '', 'filters_value_0': '["",""]', 'deleted_field': '{"deleted":true}'}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant