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

psycopg and GIS: internal error: error in argument for $1: unsupported OID 90000 with format code FormatBinary #93352

Closed
timgraham opened this issue Dec 9, 2022 · 2 comments · Fixed by #93563
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner

Comments

@timgraham
Copy link
Contributor

timgraham commented Dec 9, 2022

Describe the problem

I'm working on django-cockroachdb compatibility with psycopg. I'm not sure offhand if the following is an issue in Django/django-cockroachdb or in CockroachDB, and I thought someone on the CockroachDB side might be able to comment so I don't investigate needlessly if this is a known issue.

To Reproduce

Run Django's tests:

$  ./tests/runtests.py --settings=test_roachgis gis_tests.geogapp --failfast
...
ERROR: setUpClass (gis_tests.geogapp.tests.GeographyFunctionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/code/django/django/db/backends/utils.py", line 91, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/.virtualenvs/django39/lib/python3.9/site-packages/psycopg/cursor.py", line 725, in execute
    raise ex.with_traceback(None)
psycopg.errors.InternalError_: internal error: error in argument for $1: unsupported OID 90000 with format code FormatBinary
DETAIL:  stack trace:
github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgwirebase/encoding.go:866: DecodeDatum()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:433: func2()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:450: execBind()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:2061: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1874: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:831: ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:728: func1()
GOROOT/src/runtime/asm_amd64.s:1594: goexit()

HINT:  You have encountered an unexpected error.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.

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

Traceback (most recent call last):
  File "/home/tim/code/django/django/test/testcases.py", line 1458, in setUpClass
    call_command(
  File "/home/tim/code/django/django/core/management/__init__.py", line 194, in call_command
    return command.execute(*args, **defaults)
  File "/home/tim/code/django/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/home/tim/code/django/django/core/management/commands/loaddata.py", line 102, in handle
    self.loaddata(fixture_labels)
  File "/home/tim/code/django/django/core/management/commands/loaddata.py", line 163, in loaddata
    self.load_label(fixture_label)
  File "/home/tim/code/django/django/core/management/commands/loaddata.py", line 253, in load_label
    if self.save_obj(obj):
  File "/home/tim/code/django/django/core/management/commands/loaddata.py", line 209, in save_obj
    obj.save(using=self.using)
  File "/home/tim/code/django/django/core/serializers/base.py", line 288, in save
    models.Model.save_base(self.object, using=using, raw=True, **kwargs)
  File "/home/tim/code/django/django/db/models/base.py", line 877, in save_base
    updated = self._save_table(
  File "/home/tim/code/django/django/db/models/base.py", line 990, in _save_table
    updated = self._do_update(
  File "/home/tim/code/django/django/db/models/base.py", line 1054, in _do_update
    return filtered._update(values) > 0
  File "/home/tim/code/django/django/db/models/query.py", line 1231, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 1938, in execute_sql
    cursor = super().execute_sql(result_type)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 1516, in execute_sql
    cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/home/tim/code/django/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/tim/code/django/django/db/backends/utils.py", line 91, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/tim/code/django/django/db/backends/utils.py", line 91, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/.virtualenvs/django39/lib/python3.9/site-packages/psycopg/cursor.py", line 725, in execute
    raise ex.with_traceback(None)
django.db.utils.InternalError: Problem installing fixture '/home/tim/code/django/tests/gis_tests/relatedapp/fixtures/initial.json': Could not load relatedapp.Location(pk=1): internal error: error in argument for $1: unsupported OID 90000 with format code FormatBinary
DETAIL:  stack trace:
github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgwirebase/encoding.go:866: DecodeDatum()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:433: func2()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:450: execBind()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:2061: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1874: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:831: ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:728: func1()
GOROOT/src/runtime/asm_amd64.s:1594: goexit()

HINT:  You have encountered an unexpected error.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.

Additional data / screenshots

I believe the query in question is

UPDATE "relatedapp_location" SET "point" = %s WHERE "relatedapp_location"."id" = %s
args: (<django.contrib.gis.db.backends.postgis.adapter.PostGISAdapter object at 0x7f2495535220>, 1)

Happy to provide more details if needed.

Environment:

  • CockroachDB version v23.1.0-alpha.00000000-1052-g223f580489
    Build Time: 2022/12/08 23:07:55

Jira issue: CRDB-22281

@timgraham timgraham added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Dec 9, 2022
@blathers-crl
Copy link

blathers-crl bot commented Dec 9, 2022

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I have CC'd a few people who may be able to assist you:

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Dec 9, 2022
@rafiss
Copy link
Collaborator

rafiss commented Dec 9, 2022

Thanks for reporting this. We've received automated reports of these errors from our Cloud telemetry, but didn't know where it came from. See #81066 for the explanation. It's a fix we need to make in CockroachDB, and this issue report helps us prioritize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants