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

Allow alternate definitions of NAMEDATALEN identifier limit #268

Open
wants to merge 1 commit into
base: 16-latest
Choose a base branch
from

Conversation

david-h-muller
Copy link

What

This PR surrounds the definition of the NAMEDATALEN constant with an #ifndef.

Why

Increasing NAMEDATALEN allows you to, for example, avoid the truncation normally produced by the postgres parser on this 65 character identifier:

SELECT aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345
{
  "stmts": [
    {
      "stmt": {
        "SelectStmt": {
          "limitOption": "LIMIT_OPTION_DEFAULT",
          "op": "SETOP_NONE",
          "targetList": [
            {
              "ResTarget": {
                "location": 7,
                "val": {
                  "ColumnRef": {
                    "fields": [
                      {
                        "String": {
- "sval": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123"
+ "sval": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345"
                        }
                      }
                    ],
                    "location": 7
                  }
                }
              }
            }
          ]
        }
      }
    }
  ],
  "version": 150001
}

Notes

To generate this PR and validate it, I needed to run make extract_source.

To get make extract_source working, I needed these 3 pre-requisites:

  1. macOS.
  2. ruby 3.1.2.
  3. gem ffi-clang 0.8.0
    • gem install ffi-clang --version'0.8.0'
    • I did not see the ffi-clang requirement pinned or documented anywhere, but versions of ffi-clang newer than 0.8.0 move the visit_children method and cause a runtime error in extract_source.rb:
extract_source.rb:260:in `analyze_file': undefined method `visit_children' for an instance of FFI::Clang::Cursor (NoMethodError)

    cursor.visit_children do |cursor, parent|
          ^^^^^^^^^^^^^^^

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.

1 participant