Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Fixed length VARCHAR isn't enforced #1380

Open
mbutrovich opened this issue Dec 7, 2020 · 0 comments
Open

Fixed length VARCHAR isn't enforced #1380

mbutrovich opened this issue Dec 7, 2020 · 0 comments
Assignees
Labels
bug Something isn't working (correctness). Mark issues with this.

Comments

@mbutrovich
Copy link
Contributor

Bug Report

Summary

We don't check whether incoming VARCHAR values adhere to the length limit.

Expected Behavior

Postgres:

matt=# create table foo (name varchar(3));
CREATE TABLE
Time: 14.160 ms
matt=# insert into foo values ('andy');
ERROR:  value too long for type character varying(3)
Time: 1.514 ms

Actual Behavior

NoisePage:

noisepage=# create table foo (name varchar(3));
CREATE TABLE
Time: 126.967 ms
noisepage=# insert into foo values ('andy');
INSERT 0 1
Time: 64.881 ms

Proposed Solution

I suspect this should be resolved in the binder. It has access to the query arguments (or prepared statement arguments) and access to the Catalog to check the schema. We should confirm what stage Postgres enforces this at if possible, and then return the same error code.

@mbutrovich mbutrovich added the bug Something isn't working (correctness). Mark issues with this. label Dec 7, 2020
@eppingere eppingere self-assigned this Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working (correctness). Mark issues with this.
Projects
None yet
Development

No branches or pull requests

2 participants