aprismatic / prismadb

Prisma/DB public releases and documentation.
34 stars 1 forks source link

Incorrect Error Statement #5

Open saklanipankaj opened 5 years ago

saklanipankaj commented 5 years ago
CREATE TABLE t2
(
    a DOUBLE,
    b INT ENCRYPTED FOR (MULTIPLICATION, ADDITION, RANGE),
    c INT,
    d VARCHAR(10) ENCRYPTED FOR (STORE, SEARCH),
    e VARCHAR(30)
);

Error Statement: 42601: syntax error at or near "ENCRYPTED" Error is the wrong DATATYPE DOUBLE being used, should be DOUBLE PRECISION, however the error message states the syntax error to be near the word "ENCRYPTED"

cheziyi commented 5 years ago

Currently, if Prisma/DB is unable to parse a statement (due to a wrong or unsupported syntax), it will forward the query to the database directly. This is because we do not have support of the full SQL language yet. Therefore, the error thrown is by the database itself, which does not recognize the ENCRYPTED keyword.

That said, better error messages are in the pipeline, so cases like this will be less confusing to the user.

bazzilic commented 4 years ago

if Prisma/DB is unable to parse a statement (due to a wrong or unsupported syntax), it will forward the query to the database directly

@cheziyi I think Prisma/DB no longer does this?

cheziyi commented 4 years ago

if Prisma/DB is unable to parse a statement (due to a wrong or unsupported syntax), it will forward the query to the database directly

@cheziyi I think Prisma/DB no longer does this?

It does, as long as it can't be parsed.

bazzilic commented 4 years ago

Are you sure? My understanding was that whatever can't be parsed errors out, and if you need to send through you can do PRISMADB BYPASS ...

cheziyi commented 4 years ago

Are you sure? My understanding was that whatever can't be parsed errors out, and if you need to send through you can do PRISMADB BYPASS ...

Yup, queries that can't be parsed are sent to the database directly to attempt to have as much support for DB clients as possible. PRISMADB BYPASS is meant for queries that can be parsed, but we do not want to execute at the proxy. It will still work for queries that can't be parsed.