Use "person" instead of "user" table #2132

Closed
opened 2026-03-13 09:29:20 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @mariusa on GitHub (Oct 16, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Since "user" is a reserved keyword in some databases (pg), would you please consider using "person" instead?
I know one can overwrite table names in config (with an user view still being required, due to some code still referencing "user"), but it would be a cleaner default setup.

Thanks

Current vs. Expected behavior

Create table user fails on pg. Must use quotes.

What version of Better Auth are you using?

1.x.x

System info

n/a

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

No response

Originally created by @mariusa on GitHub (Oct 16, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Since "user" is a reserved keyword in some databases (pg), would you please consider using "person" instead? I know one can overwrite table names in config (with an user view still being required, due to some code still referencing "user"), but it would be a cleaner default setup. Thanks ### Current vs. Expected behavior Create table user fails on pg. Must use quotes. ### What version of Better Auth are you using? 1.x.x ### System info ```bash n/a ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
Author
Owner

@dosubot[bot] commented on GitHub (Oct 16, 2025):

Better Auth uses "user" as the default table name and quotes it in SQL to avoid issues with PostgreSQL's reserved keywords. You can override table names in the config, but some internal references (like foreign keys in the session table) still expect a "user" table or view to exist, so a full rename to "person" may require creating a view named "user" for compatibility. There isn't a built-in option to globally switch all references to "person" instead of "user" as the default, but the adapter and schema are designed to allow some customization if you want to experiment with it in your setup cite cite.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Oct 16, 2025): <!-- Answer --> Better Auth uses "user" as the default table name and quotes it in SQL to avoid issues with PostgreSQL's reserved keywords. You can override table names in the config, but some internal references (like foreign keys in the session table) still expect a "user" table or view to exist, so a full rename to "person" may require creating a view named "user" for compatibility. There isn't a built-in option to globally switch all references to "person" instead of "user" as the default, but the adapter and schema are designed to allow some customization if you want to experiment with it in your setup [cite](https://github.com/better-auth/better-auth/blob/c3acb35269bb2881d30580a6bfc5a0dd4ccb8691/packages/better-auth/src/adapters/adapter-factory/index.ts) [cite](https://github.com/better-auth/better-auth/pull/3906). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1904f312-8748-4b1d-8524-1a9284b1d19e?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/5353)
Author
Owner

@ping-maxwell commented on GitHub (Oct 19, 2025):

are you using Kysely that isn't adding quotes to user ?

@ping-maxwell commented on GitHub (Oct 19, 2025): are you using Kysely that isn't adding quotes to `user `?
Author
Owner

@mariusa commented on GitHub (Oct 19, 2025):

No, sometimes pg directly, sometimes sequelize, sometimes we connect to db with a desktop client

@mariusa commented on GitHub (Oct 19, 2025): No, sometimes pg directly, sometimes sequelize, sometimes we connect to db with a desktop client
Author
Owner

@ping-maxwell commented on GitHub (Oct 19, 2025):

I meant for the better-auth adapter, what adapter are you using?

@ping-maxwell commented on GitHub (Oct 19, 2025): I meant for the better-auth adapter, what adapter are you using?
Author
Owner

@mariusa commented on GitHub (Oct 19, 2025):

pg.Pool. But even if better-auth works fine with "user", other clients or manually made queries will still have issues.
I guess question is if you see "user" or "person" as a better fit for better-auth. Either is fine, thanks for considering.

@mariusa commented on GitHub (Oct 19, 2025): `pg.Pool`. But even if better-auth works fine with "user", other clients or manually made queries will still have issues. I guess question is if you see "user" or "person" as a better fit for better-auth. Either is fine, thanks for considering.
Author
Owner

@Bekacru commented on GitHub (Oct 19, 2025):

"Person" would be non-standard. If we had followed the plural table naming convention (users instead of user), this might have been less of an issue. Maybe we should consider enforcing plural table names for Kysely as we do for Drizzle and others

@Bekacru commented on GitHub (Oct 19, 2025): "Person" would be non-standard. If we had followed the plural table naming convention (`users` instead of `user`), this might have been less of an issue. Maybe we should consider enforcing plural table names for Kysely as we do for Drizzle and others
Author
Owner

@mariusa commented on GitHub (Oct 19, 2025):

I'll rename my person table to user and report tomorrow if any issues besides quoting being needed with other clients.

@mariusa commented on GitHub (Oct 19, 2025): I'll rename my `person` table to `user` and report tomorrow if any issues besides quoting being needed with other clients.
Author
Owner

@mariusa commented on GitHub (Oct 20, 2025):

Switched to "user", it works fine

@mariusa commented on GitHub (Oct 20, 2025): Switched to "user", it works fine
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2132