yugabyte-db icon indicating copy to clipboard operation
yugabyte-db copied to clipboard

[YSQL] Send nullable column flag to DocDB

Open andrei-mart opened this issue 3 years ago • 1 comments

Jira Link: DB-1064

Description

If the "not null" property set for a column we can not push down expressions evaluating values for that column. This limitation is because the not null constraint evaluation happens in Postgres, DocDB does not even have the nullable/not null flag set for non-PK columns. If we send the flag down when the column is created we will be able to check the value in DocDB and therefore push down expressions for not null columns, and have more of single line and bufferable updates in our workloads. We would need to support both CREATE TABLE and ALTER TABLE commands.

andrei-mart avatar Feb 25 '22 02:02 andrei-mart

~~Apparently the NOT NULL flag is currently used to indicate the column is a part of PK. So if it is set in DocDB for regular not null columns, Postgres planner gets confused and thinks that PK is longer that it is and can not handle single row updates properly. Postgres has PK information in its metadata, and it can be used to construct proper PK info without using the NOT NULL flag. However, it is not clear at this point if that flag is used in DocDB internally, and if it is, what would it take to replace it with something else.~~ False alarm. In the implementation of the CREATE TABLE command I accidentally swapped is_range and is_notnull arguments in one of the PgGate functions.

andrei-mart avatar Mar 01 '22 18:03 andrei-mart