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

fix(qe): Change Array(None) to return Null value. #5228

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

igort99
Copy link

@igort99 igort99 commented Mar 5, 2025

Description

In PostgreSQL, a nullable array column can hold either a null value or an empty array ({}), and these are semantically different. Previously, Prisma treated both cases as an empty array. This fix ensures that when the database returns a null for a nullable array column, Prisma correctly returns a null instead of an empty list.

Related Issue

Changes Made

  • Updated the conversion logic for list fields in the SQL row conversion. The branch that previously matched any null value and returned an empty list has been modified (or removed) so that a SQL null is properly recognized.

Screenshots (if applicable)

Before the fix, the following query would return an empty array for a null column:

CREATE OR REPLACE TABLE nullable_array ( arr text[] );
INSERT INTO nullable_array VALUES (null);

@igort99 igort99 requested a review from a team as a code owner March 5, 2025 20:30
@igort99 igort99 requested review from FGoessler and removed request for a team March 5, 2025 20:30
@CLAassistant
Copy link

CLAassistant commented Mar 5, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

codspeed-hq bot commented Mar 6, 2025

CodSpeed Performance Report

Merging #5228 will not alter performance

Comparing igort99:fix/null-array-returned-as-empty (e63b80d) with main (56bd63f)

Summary

✅ 11 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants