PostgreSQL: "incorrect binary data format in bind parameter x"

See original GitHub issue

To reproduce, import this (pasted below) SQL into a Postgres database.

create extension if not exists "pgcrypto";

create or replace function set_updated_at() RETURNS trigger
  LANGUAGE plpgsql
  AS $$
begin
  new.updated_at := current_timestamp;
  return new;
end;
$$;

create table if not exists users (
  id uuid primary key not null default gen_random_uuid(),
  "name" text not null,
  handle text not null,
  created_at timestamp not null default now(),
  updated_at timestamp not null default now()
);
create trigger updated_at before update on users for each row execute procedure set_updated_at();

create table if not exists locations (
  id uuid primary key not null default gen_random_uuid(),
  latitude float not null,
  longitude float not null
);

create table if not exists tweets (
  id uuid primary key not null default gen_random_uuid(),
  created_at timestamp not null default now(),
  "text" text not null,
  "owner" uuid not null references users(id) on delete cascade,
  "location" uuid not null references locations(id) on delete cascade
);

Introspect this database

prisma2 introspect --url 'postgresql://root:prisma@localhost:5432/basic-twitter?schema=public'

Run the following client call:

const { PrismaClient } = require('@prisma/client')

const prisma = new PrismaClient()

async function main() {
  const data = await prisma.locations.create({
    data: {
      id: 'f70c6744-c2cb-5a28-b4c6-5aa0680dac0c',
      latitude: 234.96,
      longitude: -391.52,
    },
  })
  console.log(data)
}

main().finally(() => prisma.disconnect())

Error observed:

Invalid `prisma.locations.create()` invocation in 
./index.js:6:60 
 
Error occurred during query execution: 
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("22P03"), message: "incorrect binary data format in bind parameter 1", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("postgres.c"), line: Some(1828), routine: Some("exec_bind_message") }) }) }) 
  at ​index.js:6:2​
  at ​​​processTicksAndRejections​​​ ​internal/process/task_queues.js:85​

Internal notes:

Test utils database(s) affected:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
divyenduzcommented, Mar 16, 2020

This one is no longer reproducible on the latest alpha (starting with 902)

divyendusingh [introspection-engine-output]$ prisma2 --version
prisma2@2.0.0-alpha.902, binary version: 7f34f2252d46d463cf9a2e45488385c5adb0a49b
1reaction
divyenduzcommented, Mar 12, 2020

Yes! We should

Read more comments on GitHub >

github_iconTop Results From Across the Web

"incorrect binary data format in bind parameter" while ... - ERROR
bit type data must match the length n exactly; it is an error to attempt to store shorter or longer bit strings.bit varying...
Read more >
Not able to insert binary data in strings of 0 and 1 with ...
Product: DataDirect Connect64 for ODBC PostgreSQL driver Version: 7.1.6.x OS: All ... incorrect binary data format in bind parameter 1.
Read more >
psycopg2: inexplicable 'DataError: incorrect binary data format'
I'm using a COPY ... WITH BINARY query. The tables I'm copying, only contain integers and only go into tables containing integers.
Read more >
Re: binding 64-bit integer - PostgreSQL
errmsg("incorrect binary data format in bind parameter %d", paramno + 1))); ... I wanted to bind a 64-bit integer, but it failed:
Read more >
type-graphql/prisma2 - Gitter
Environment variables loaded from /Users/BB/prisma/.env ... an error message of "incorrect binary data format in bind parameter 3", anyone have any insight?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found