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

Ecto/Postgrex triggering ERROR 08P01 (protocol_violation) SimpleQuery not allowed while in extended protocol mode #50858

Closed
perezd opened this issue Jul 1, 2020 · 3 comments
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 X-blathers-triaged blathers was able to find an owner

Comments

@perezd
Copy link

perezd commented Jul 1, 2020

Describe the problem

Attempting a basic query from my unit testing framework ExUnit (using Elixir/Ecto/Postgrex). This is a very basic test that simply queries the database (logs included below).

To Reproduce

Queries ran during test:

03:16:14.172 [debug] QUERY OK db=2.8ms
begin []
03:16:14.187 [debug] QUERY OK db=2.9ms
INSERT INTO "locations" ("name","state","zip") VALUES ($1,$2,$3),($4,$5,$6),($7,$8,$9) ["a", "CA", "95050", "b", "CA", "95050", "c", "CA", "95050"]
03:16:14.187 [debug] QUERY OK db=0.5ms
commit []
03:16:14.200 [debug] QUERY ERROR source="locations" db=0.7ms queue=0.5ms
SELECT l0."id", l0."state", l0."zip", l0."name" FROM "locations" AS l0 []
03:16:14.201 [error] Postgrex.Protocol (#PID<0.272.0>) disconnected: ** (Postgrex.Error) ERROR 08P01 (protocol_violation) SimpleQuery not allowed while in extended protocol mode

Expected behavior
Rows returned as requested. Note, this does work in a non-unit testing environment. I am able to write these queries and execute them interactively just fine, something strange is happening under test. This could be related to how they manage SQL sandboxes in Ecto? https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.Sandbox.html#content

Additional data / screenshots

Table def:

CREATE SEQUENCE location_id_seq START 1 INCREMENT 1
CREATE TABLE locations (
  state VARCHAR(2) NOT NULL,
  zip VARCHAR(5) NOT NULL,
  id INT8 NOT NULL DEFAULT nextval('location_id_seq':::STRING),
  name VARCHAR(255) NOT NULL,
  CONSTRAINT "primary" PRIMARY KEY (state ASC, zip ASC, id ASC),
  FAMILY "primary" (state, zip, id, name)
)

Environment:
Cockroach version:
Build Tag: v20.1.3
Build Time: 2020/06/23 08:49:00
Distribution: CCL
Platform: linux amd64 (x86_64-unknown-linux-musl)
Go Version: go1.13.9
C Compiler: gcc 6.3.0
Build SHA-1: 7fd454f
Build Type: release

Additional context

This is very similar to what I've seen here: #41511.
Maybe should be tracked here? #33441

@blathers-crl
Copy link

blathers-crl bot commented Jul 1, 2020

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 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Jul 1, 2020
@rafiss
Copy link
Collaborator

rafiss commented Jul 1, 2020

Thanks for the report! I added it to the Ecto tracking issue.

@rafiss
Copy link
Collaborator

rafiss commented Jul 13, 2020

This is resolved by #51194 (which is also going to be included in the next 20.1 release).

@rafiss rafiss closed this as completed Jul 13, 2020
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 X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

No branches or pull requests

2 participants