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

Handle maximum table name length #37

Merged
merged 5 commits into from
Aug 14, 2023
Merged

Handle maximum table name length #37

merged 5 commits into from
Aug 14, 2023

Conversation

vrmiguel
Copy link
Member

First PR for #33

This PR ensures tables are at most 59-characters long, since by default Postgres limits identifiers to 63 characters, and we add to it a 4-bytes long prefix. This is configurable, but would require building Postgres from source.

Docs: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

@ChuckHend
Copy link
Member

Nice! @vrmiguel can you add a test for a name > 58 (?) characters, and bump the version in core/Cargo.toml?

// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

// Default value of `NAMEDATALEN`, set in `src/include/pg_config_manual.h`
const NAMEDATALEN: usize = 64;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an API where this configuration can be read, so you don't need to guess?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be close, but need to look into this a bit more. Not sure how reliable it would be for our use case.

show max_identifier_length;
 max_identifier_length 
-----------------------
 63
(1 row)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vrmiguel vrmiguel merged commit e03f09f into main Aug 14, 2023
10 checks passed
@vrmiguel vrmiguel deleted the max-table-name-len branch August 14, 2023 18:04
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.

3 participants