Skip to content

LabKey SQL hints and nits - #7835

Merged
labkey-matthewb merged 10 commits into
release26.7-SNAPSHOTfrom
26.7_fb_sql_hints
Jul 28, 2026
Merged

LabKey SQL hints and nits#7835
labkey-matthewb merged 10 commits into
release26.7-SNAPSHOTfrom
26.7_fb_sql_hints

Conversation

@labkey-matthewb

@labkey-matthewb labkey-matthewb commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Rationale

Targeted changes to help AI Assistant avoid and self-correct SQL generation mistakes.
Added support for CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP

Related Pull Requests

Changes

@labkey-matthewb
labkey-matthewb requested a review from XingY July 15, 2026 19:06
@labkey-matthewb labkey-matthewb changed the title Add hints to many parse error messages. LabKey SQL hints and nits Jul 24, 2026
@labkey-matthewb
labkey-matthewb marked this pull request as ready for review July 24, 2026 17:46
}

// "is distinct from" and "is not distinct from" operators in method form
labkeyMethod.put("is_distinct_from", new Method(JdbcType.BOOLEAN, 2, 2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this applied from a patch? They should be added around line 546 instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

??? must not have pushed my last commit (obviously doesn't build this way)

String notDistinctValue = token == IS ? dialect.getBooleanFALSE() : dialect.getBooleanTRUE();
String distinctValue = token == IS ? dialect.getBooleanTRUE() : dialect.getBooleanFALSE();

ret.append("(CASE WHEN (").append(a).append(") = (").append(b).append(")");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This (CASE WHEN) expression works as SELECT, but would it work in WHERE?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. I'll double check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A function() really should return a value, but this breaks compatibility on mssql, so I'll switch this. This is really a hack anyway, on develop I'll add support for the proper "IS DISTINCT FROM" syntax.

@labkey-matthewb
labkey-matthewb requested a review from XingY July 27, 2026 17:47
@labkey-matthewb
labkey-matthewb merged commit 5feb5cd into release26.7-SNAPSHOT Jul 28, 2026
7 of 8 checks passed
@labkey-matthewb
labkey-matthewb deleted the 26.7_fb_sql_hints branch July 28, 2026 00:45
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.

2 participants