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

Incorrect handling of NULL values in query results using Drizzle and Xata #1314

Closed
realmikesolo opened this issue Jan 8, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@realmikesolo
Copy link

Describe the bug

The problem occurs when performing a select query on a table that contains columns with NULL values using @xata.io/drizzle. When I use other drivers with drizzle, for example, pg everything works out.

To Reproduce

export const userTable = pgTable('users', {
  id: varchar('id', { length: 255 }).primaryKey(),
  name: text('name'),
  gender: text('gender'),
});
const result = await db.select().from(usersTable);
// result
[
  { id: 'rec_cmbi5ajff3lbs66vplug', name: '', gender: '' },
  { id: 'rec_cmbi8frff3lbs66vpms0', name: '', gender: '' }
]

Results in an output where NULL values are incorrectly replaced with empty strings.

Expected behavior

The expected behavior is that the query should return NULL values.

// result
[
  { id: 'rec_cmbi5ajff3lbs66vplug', name: null, gender: null },
  { id: 'rec_cmbi8frff3lbs66vpms0', name: null, gender: null }
]

Software version

@xata.io/client: "^0.28.3",
@xata.io/drizzle: "^0.0.14"

@SferaDev
Copy link
Member

Hey @realmikesolo, we have merged a fix for this issue in the backend. We are currently rewriting the drizzle adapter to support both http and wire protocol connections. I will leave the issue open until we release the new one and double check it works there too. Thanks for reporting!

@realmikesolo
Copy link
Author

Hey, @SferaDev! Thanks for your work

@SferaDev SferaDev closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants