salopensource / sal

Modular reporting for Endpoints
Apache License 2.0
212 stars 64 forks source link

manage.py migrate psycopg2.errors.SyntaxError #399

Closed tpegues2 closed 3 years ago

tpegues2 commented 4 years ago

Describe the bug Unable to run manage.py migrate with out errors.

To Reproduce manage.py migrate

Expected behavior Should run to completion with no errors. Screenshots (sal_env) [saluser@saltstweb01 sal]$ python2.7 manage.py migrate Operations to perform: Apply all migrations: admin, auth, catalog, contenttypes, inventory, licenses, profiles, search, server, sessions, sites Running migrations: Applying server.0001_squashed_0023_auto_20151130_1036...Traceback (most recent call last): File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) psycopg2.errors.SyntaxError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co...Server (please complete the following information):

If possible, please replicate the issue while Sal is in debug mode.

grahamgilbert commented 4 years ago

(sal_env) [saluser@saltstweb01 sal]$ python2.7 manage.py migrate

Are you using this with Python 2? Sal requires Python 3+

tpegues2 commented 4 years ago

Yes. I do have it installed. I think I tried 2.7 out of desperation. 😊

(sal_env) [saluser@saltstweb01 sal]$ /srv/saluser/sal_env/bin/python3.6 manage.py migrate Operations to perform: Apply all migrations: admin, auth, catalog, contenttypes, inventory, licenses, profiles, search, server, sessions, sites Running migrations: Applying server.0001_squashed_0023_auto_20151130_1036...Traceback (most recent call last): File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) psycopg2.errors.SyntaxError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, cmd_options) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute output = self.handle(*args, *options) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(args, kwargs) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 233, in handle fake_initial=fake_initial, File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 249, in database_forwards schema_editor.alter_field(from_model, from_field, to_field) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 565, in alter_field old_db_params, new_db_params, strict) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 154, in _alter_field new_db_params, strict, File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 573, in _alter_field fk_names = self._constraint_names(model, [old_field.column], foreign_key=True) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 1148, in _constraint_names constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/postgresql/introspection.py", line 166, in get_constraints """, [table_name]) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers return executor(sql, params, many, context) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... ^

From: Graham Gilbert notifications@github.com Reply-To: salopensource/sal reply@reply.github.com Date: Wednesday, July 22, 2020 at 1:10 PM To: salopensource/sal sal@noreply.github.com Cc: Tharrow Pegues tpegues2@kennesaw.edu, Author author@noreply.github.com Subject: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

(sal_env) [saluser@saltstweb01 sal]$ python2.7 manage.py migrate

Are you using this with Python 2? Sal requires Python 3+

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/salopensource/sal/issues/399#issuecomment-662575350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKCBRHR4YBNO2YSGGYX7HB3R44MOTANCNFSM4PE4P7RQ.

CAUTION: This email originated from outside of KSU. Use caution replying or supplying information, clicking links or opening attachments. If you suspect the message is fraudulent, contact the UITS Service Desk at 470-578-6999 or service@kennesaw.edumailto:servicedesk@kennesaw.edu.

tpegues2 commented 4 years ago

Any other ideas about what I could try to resolve this error?

From: Tharrow Pegues tpegues2@kennesaw.edu Date: Wednesday, July 22, 2020 at 2:01 PM To: salopensource/sal reply@reply.github.com, salopensource/sal sal@noreply.github.com Cc: Author author@noreply.github.com Subject: Re: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

Yes. I do have it installed. I think I tried 2.7 out of desperation. 😊

(sal_env) [saluser@saltstweb01 sal]$ /srv/saluser/sal_env/bin/python3.6 manage.py migrate Operations to perform: Apply all migrations: admin, auth, catalog, contenttypes, inventory, licenses, profiles, search, server, sessions, sites Running migrations: Applying server.0001_squashed_0023_auto_20151130_1036...Traceback (most recent call last): File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) psycopg2.errors.SyntaxError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, cmd_options) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute output = self.handle(*args, *options) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(args, kwargs) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 233, in handle fake_initial=fake_initial, File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 249, in database_forwards schema_editor.alter_field(from_model, from_field, to_field) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 565, in alter_field old_db_params, new_db_params, strict) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 154, in _alter_field new_db_params, strict, File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 573, in _alter_field fk_names = self._constraint_names(model, [old_field.column], foreign_key=True) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 1148, in _constraint_names constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/postgresql/introspection.py", line 166, in get_constraints """, [table_name]) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers return executor(sql, params, many, context) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... ^

From: Graham Gilbert notifications@github.com Reply-To: salopensource/sal reply@reply.github.com Date: Wednesday, July 22, 2020 at 1:10 PM To: salopensource/sal sal@noreply.github.com Cc: Tharrow Pegues tpegues2@kennesaw.edu, Author author@noreply.github.com Subject: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

(sal_env) [saluser@saltstweb01 sal]$ python2.7 manage.py migrate

Are you using this with Python 2? Sal requires Python 3+

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/salopensource/sal/issues/399#issuecomment-662575350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKCBRHR4YBNO2YSGGYX7HB3R44MOTANCNFSM4PE4P7RQ.

CAUTION: This email originated from outside of KSU. Use caution replying or supplying information, clicking links or opening attachments. If you suspect the message is fraudulent, contact the UITS Service Desk at 470-578-6999 or service@kennesaw.edumailto:servicedesk@kennesaw.edu.

tpegues2 commented 4 years ago

Hi Gilbert,

Is there a required version of psycop2 we should be using?

Running migrations: Applying server.0001_squashed_0023_auto_20151130_1036...Traceback (most recent call last): File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) psycopg2.errors.SyntaxError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co...

From: Tharrow Pegues tpegues2@kennesaw.edu Date: Tuesday, August 4, 2020 at 4:00 PM To: salopensource/sal reply@reply.github.com, salopensource/sal sal@noreply.github.com Cc: Author author@noreply.github.com Subject: Re: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

Any other ideas about what I could try to resolve this error?

From: Tharrow Pegues tpegues2@kennesaw.edu Date: Wednesday, July 22, 2020 at 2:01 PM To: salopensource/sal reply@reply.github.com, salopensource/sal sal@noreply.github.com Cc: Author author@noreply.github.com Subject: Re: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

Yes. I do have it installed. I think I tried 2.7 out of desperation. 😊

(sal_env) [saluser@saltstweb01 sal]$ /srv/saluser/sal_env/bin/python3.6 manage.py migrate Operations to perform: Apply all migrations: admin, auth, catalog, contenttypes, inventory, licenses, profiles, search, server, sessions, sites Running migrations: Applying server.0001_squashed_0023_auto_20151130_1036...Traceback (most recent call last): File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) psycopg2.errors.SyntaxError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, cmd_options) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute output = self.handle(*args, *options) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(args, kwargs) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 233, in handle fake_initial=fake_initial, File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 249, in database_forwards schema_editor.alter_field(from_model, from_field, to_field) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 565, in alter_field old_db_params, new_db_params, strict) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 154, in _alter_field new_db_params, strict, File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 573, in _alter_field fk_names = self._constraint_names(model, [old_field.column], foreign_key=True) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 1148, in _constraint_names constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/postgresql/introspection.py", line 166, in get_constraints """, [table_name]) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers return executor(sql, params, many, context) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/srv/saluser/sal_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... ^

From: Graham Gilbert notifications@github.com Reply-To: salopensource/sal reply@reply.github.com Date: Wednesday, July 22, 2020 at 1:10 PM To: salopensource/sal sal@noreply.github.com Cc: Tharrow Pegues tpegues2@kennesaw.edu, Author author@noreply.github.com Subject: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

(sal_env) [saluser@saltstweb01 sal]$ python2.7 manage.py migrate

Are you using this with Python 2? Sal requires Python 3+

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/salopensource/sal/issues/399#issuecomment-662575350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKCBRHR4YBNO2YSGGYX7HB3R44MOTANCNFSM4PE4P7RQ.

CAUTION: This email originated from outside of KSU. Use caution replying or supplying information, clicking links or opening attachments. If you suspect the message is fraudulent, contact the UITS Service Desk at 470-578-6999 or service@kennesaw.edumailto:servicedesk@kennesaw.edu.

grahamgilbert commented 4 years ago

My name is Graham, not Gilbert.

You should use the version that is in the requirements file. The recommendation is to use the docker image, since Sal is untested on anything other than Debian (the OS the image is based on).

tpegues2 commented 4 years ago

My sincere apologies. It’s been a crazy week. Thank you so much for your help! I will give it a try.

From: Graham Gilbert notifications@github.com Reply-To: salopensource/sal reply@reply.github.com Date: Tuesday, August 4, 2020 at 5:22 PM To: salopensource/sal sal@noreply.github.com Cc: Tharrow Pegues tpegues2@kennesaw.edu, Author author@noreply.github.com Subject: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

My name is Graham, not Gilbert.

You should use the version that is in the requirements filehttps://github.com/salopensource/sal/blob/master/requirements.txt#L3. The recommendation is to use the docker image, since Sal is untested on anything other than Debian (the OS the image is based on).

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/salopensource/sal/issues/399#issuecomment-668831862, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKCBRHV5MILHEE2JEUEVXJDR7B3YRANCNFSM4PE4P7RQ.

CAUTION: This email originated from outside of KSU. Use caution replying or supplying information, clicking links or opening attachments. If you suspect the message is fraudulent, contact the UITS Service Desk at 470-578-6999 or service@kennesaw.edumailto:servicedesk@kennesaw.edu.

tpegues2 commented 4 years ago

Hi Graham,

We were able to make it pass the error by rebuilding the database so all is well. However, after the upgrade from 4.1.3 to 4.1.6 only shows that we are at version 4.1.4 which is unrelated to my previous issue but I think the changes are minor from 4.1.4 to 4.1.5 and/or 4.1.6. There may already be something out there to address this. I will take a look first.

Many Thanks For Your Assistance!!!

Have a great week!!!

Tharrow

From: Graham Gilbert notifications@github.com Reply-To: salopensource/sal reply@reply.github.com Date: Tuesday, August 4, 2020 at 5:22 PM To: salopensource/sal sal@noreply.github.com Cc: Tharrow Pegues tpegues2@kennesaw.edu, Author author@noreply.github.com Subject: [EXTERNAL] Re: [salopensource/sal] manage.py migrate psycopg2.errors.SyntaxError (#399)

My name is Graham, not Gilbert.

You should use the version that is in the requirements filehttps://github.com/salopensource/sal/blob/master/requirements.txt#L3. The recommendation is to use the docker image, since Sal is untested on anything other than Debian (the OS the image is based on).

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/salopensource/sal/issues/399#issuecomment-668831862, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKCBRHV5MILHEE2JEUEVXJDR7B3YRANCNFSM4PE4P7RQ.

CAUTION: This email originated from outside of KSU. Use caution replying or supplying information, clicking links or opening attachments. If you suspect the message is fraudulent, contact the UITS Service Desk at 470-578-6999 or service@kennesaw.edumailto:servicedesk@kennesaw.edu.