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

PHP: Laravel : not generating case sensitive query #320

Closed
vinodnarayankar opened this issue May 18, 2023 · 1 comment
Closed

PHP: Laravel : not generating case sensitive query #320

vinodnarayankar opened this issue May 18, 2023 · 1 comment
Assignees
Labels
question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team

Comments

@vinodnarayankar
Copy link

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of PDO/PHP driver are you using?
    php 8.0.8

  2. What operating system and processor architecture are you using?
    WINDOWS 11

  3. What version of C/C++ compiler are you using?

  4. What did you do?

I am trying to connect snowflake with PHP and Laravel. Connection is successful. I am able to access the database. In few cases, Laravel is generating query in upper case. Would help me providing possible solution through which my queries generate in lower case. One of the generated query through laravel is as below. in my DB I have ROLES.ID is lower case.

SQLSTATE[42000]: Syntax error or access violation: 904 SQL compilation error: error line 1 at position 190 invalid identifier 'ROLES.ID' (SQL: select ROLES.*, MODEL_HAS_ROLES.MODEL_ID AS PIVOT_MODEL_ID, MODEL_HAS_ROLES.ROLE_ID AS PIVOT_ROLE_ID, MODEL_HAS_ROLES.MODEL_TYPE AS PIVOT_MODEL_TYPE from ROLES inner join MODEL_HAS_ROLES on ROLES.ID = MODEL_HAS_ROLES.ROLE_ID where MODEL_HAS_ROLES.MODEL_ID in (9) and MODEL_HAS_ROLES.MODEL_TYPE = App\Repository\User)

  1. What did you expect to see?

    What should have happened and what happened instead?

  2. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

  3. What is your Snowflake account identifier, if any? (Optional)
    Snowflake account identifier: xjrpozr-bkb40621

@sfc-gh-dszmolka
Copy link
Contributor

hi and apologies for leaving this issue unattended for so long; we're changing that.

Snowflake stores the object identifier in uppercase by default. If you created an identifier with "myobject" then it will be indeed literally stored like that, in this case: lowercase myobject instead of the default MYOBJECT

Not sure about the options available in Laravel, maybe you can try

  • adding doublequotes around the tablename or the object name which you have problem with
  • or/and, set Snowflake parameter QUOTED_IDENTIFIERS_IGNORE_CASE to true (default: false) to make it ignor the casing inside the doublequotes

hope this help. marking this one as closed for now, as it doesn't seem to be an issue with the pdo_snowflake driver

@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Feb 23, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team and removed bug labels Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

2 participants