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

elsewhere and postgresql issue #1

Open
hayley opened this issue Apr 19, 2009 · 5 comments
Open

elsewhere and postgresql issue #1

hayley opened this issue Apr 19, 2009 · 5 comments
Labels

Comments

@hayley
Copy link

hayley commented Apr 19, 2009

Granted, I found this while trying to deploy mightylemon, but I figured it belonged here.

I get an error when trying to syncdb on mightylemon using postgresql. If I comment out “elsewhere”, it syncs fine. I’ve just now started trying out postgresql so I have no real background in troubleshooting it, but I don’t have this problem if I switch to a sqlite database.

django error:
psycopg2.ProgrammingError: current transaction is aborted, commands ignored until end of transaction block

postgresql error:

2009-04-19 06:26:18 UTC ERROR:  relation "elsewhere_socialnetwork" does not exist
2009-04-19 06:26:18 UTC STATEMENT:  SELECT "elsewhere_socialnetwork"."id", "elsewhere_socialnetwork"."name", "elsewhere_socialnetwork"."url", "elsewhere_socialnetwork"."identifier", "elsewhere_socialnetwork"."icon" FROM "elsewhere_socialnetwork"
2009-04-19 06:26:18 UTC ERROR:  current transaction is aborted, commands ignored until end of transaction block
2009-04-19 06:26:18 UTC STATEMENT:  SELECT "elsewhere_instantmessenger"."id", "elsewhere_instantmessenger"."name", "elsewhere_instantmessenger"."url", "elsewhere_instantmessenger"."identifier", "elsewhere_instantmessenger"."icon" FROM "elsewhere_instantmessenger"
2009-04-19 06:26:18 UTC ERROR:  current transaction is aborted, commands ignored until end of transaction block
2009-04-19 06:26:18 UTC STATEMENT:  
                    SELECT c.relname
                    FROM pg_catalog.pg_class c
                    LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
                    WHERE c.relkind IN ('r', 'v', '')
                        AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
                        AND pg_catalog.pg_table_is_visible(c.oid)
2009-04-19 06:26:18 UTC LOG:  unexpected EOF on client connection
@chrisdrackett
Copy link
Collaborator

I've never used postgresql, and suck at sql in general so I'm not sure what is going on.. maybe leah has a better idea...

@hayley
Copy link
Author

hayley commented Apr 22, 2009

Leah,
If it helps at all, here is a link to django code wiki's take on what might be the problem:

http://code.djangoproject.com/wiki/BetterErrorMessages#django.db

This pyscopg2 (PostgreSQL) error usually signifies that some previous database query was incorrect (e.g., you tried to order_by() a field that doesn't exist, or put a string in an integer column, etc.). That previous error aborted the transaction, causing all subsequent database access to fail with this message.

[...]

If you get this from a view, it probably means the immediately previous query had a problem (but was caught by an over-eager exception handler).

@restless
Copy link

restless commented Jun 1, 2009

A quick fix for this is to add to elsewhere.models the folowing:

from django.db import connection

and then in function definition for SocialNetworkData:

seen_model = connection.introspection.installed_models(['elsewhere_socialnetwork'])
if seen_model:
for network in SocialNetwork.objects.all():
....

instead of try - except block which is used there now.

Then do the same for InstantMessengerData, just changing a model name:
seen_model = connection.introspection.installed_models(['elsewhere_instantmessenger'])
...

@ericholscher
Copy link

@restless Thanks for that! Worked like a charm.

@daonb
Copy link

daonb commented Jul 20, 2009

@restless thanks! worked for me.

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

No branches or pull requests

5 participants