Skip to content

Conversation

@yewtc
Copy link

@yewtc yewtc commented Oct 12, 2018

MSSQL allows spaces (and other non-word characters) in column names. At the point that this code is executed we are looking at column names and not accessors,

+{
map
{ map { /^ (?:foreign|self) \. (\w+) $/x } ($_, $_[1]{$_}) }
{ map { /^ (?:foreign|self) \. (.+) $/x } ($_, $_[1]{$_}) }

Choose a reason for hiding this comment

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

While this regex is not DBMS-specific all new allowed characters (all of \W) seem to be relevant for MS-SQL only. So I suggest to still limit the allowed characters to those allowed in MS-SQL.

I took a quick look at https://docs.microsoft.com/en-us/sql/odbc/microsoft/column-name-limitations?view=sql-server-2017

  • ` is not allowed
  • | is not allowed

So I suggest [^`|]+.

@ribasushi
Copy link
Collaborator

ribasushi commented Nov 22, 2018 via email

@yewtc
Copy link
Author

yewtc commented Dec 30, 2018

Sorry about not replying to your reply for some time. Anyway.
I take the point about about looking at valid MSSQL column name characters, but it might happen that pipe and back tick are valid in other sqls. I think that mysql could include either it quoted.

@pdl
Copy link

pdl commented Jan 3, 2019

Looks like postgres allows everything except NUL in column names.

SELECT 'pipe' AS "|", 'backtick' AS "`", 'backslash' AS "\", 'TAB' AS U&"\0009"; -- ok
SELECT 'NUL' AS U&"\0000"; -- fails

@ribasushi
Copy link
Collaborator

Folks, the issue here isn't how to fix the code - I already indicated that doing .+ above was the right thing.

However since I wrote my last comment I realized I already went via a completely different approach in the devel branch a bit ago in 86be9bc. I will try to put out a new trial release addressing the perf. issue holding this back and have you folks give it a spin.

Sorry for the silence on this one, I could have used a less stressful set of holidays :(

@ribasushi
Copy link
Collaborator

Folks, the issue here isn't how to fix the code

I should have clarified this further: the reason this particular PR was left open was detailed earlier in #129 (comment) :

...However - there are a few other places that need a similar update, and as the PR came with no tests of any sort - the spots got missed :(

Even though there is a different implementation to be released soon which solves the problem by accident, it would still be good to have a test for this. So if time permits please contribute a test to go with the minimal changeset by @yewtc above.

Thanks!

@ribasushi ribasushi force-pushed the maint/0.0828xx branch 2 times, most recently from 1245f48 to c11281c Compare October 30, 2019 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants