silk_clear_request_log fails on Postgres
See original GitHub issuedjango-silk==3.0.0
The SQL executed to clear the request logs fail with multiple errors on Postgres 9.5.12.
The errors include:
- django.db.utils.ProgrammingError: syntax error at or near “‘silk_profile’” LINE 1: ALTER TABLE ‘silk_profile’ DISABLE TRIGGER ALL;
- Postgres needs unquoted or double quotes, but was given single quotes.
- django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint DETAIL: Table “silk_profile_queries” references “silk_profile”. HINT: Truncate table “silk_profile_queries” at the same time, or use TRUNCATE … CASCADE.
These seem to stem from changes for PR #270.
Traceback (most recent call last):
File "oc/manage.py", line 18, in <module>
main()
File "oc/manage.py", line 15, in main
execute_from_command_line(sys.argv)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/silk/management/commands/silk_clear_request_log.py", line 41, in handle
Command.delete_model(silk.models.Profile)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/silk/management/commands/silk_clear_request_log.py", line 21, in delete_model
cursor.execute("ALTER TABLE %s DISABLE TRIGGER ALL;", [table])
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/user/dev/oc/ENV/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: syntax error at or near "'silk_profile'"
LINE 1: ALTER TABLE 'silk_profile' DISABLE TRIGGER ALL;
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Documentation: 15: Appendix A. PostgreSQL Error Codes
All messages emitted by the PostgreSQL server are assigned five-character error codes that follow the SQL standard's conventions for “SQLSTATE” codes.
Read more >20.8. Error Reporting and Logging - PostgreSQL
When logging to syslog is enabled, this parameter determines how messages are delivered to syslog.
Read more >Documentation: 15: 43.9. Errors and Messages - PostgreSQL
EXCEPTION raises an error (which normally aborts the current transaction); the other levels only generate messages of different priority levels.
Read more >15: 56.2. Reporting Errors Within the Server - PostgreSQL
Error, warning, and log messages generated within the server code should be created using ereport , or its older cousin elog . The...
Read more >Documentation: 15: 36.8. Error Handling - PostgreSQL
One simple method to catch errors and warnings is to set a specific action to be executed whenever a particular condition occurs. In...
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
I’m using 3.0.1 and
silk_clear_request_log
still fails for me on Postgres with (an other) programming error:django.db.utils.ProgrammingError: permission denied: "RI_ConstraintTrigger_a_7428263" is a system trigger
It looks like this error is still happening on the latest version (django-silk 3.0.1 ) from pypi released: Jul 3, 2018. When do you plan to release a new version?