-
Notifications
You must be signed in to change notification settings - Fork 150
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
Column names can include spaces and other non 'w' characters #129
base: maint/0.0828xx
Are you sure you want to change the base?
Conversation
@@ -1531,7 +1531,7 @@ sub reverse_relationship_info { | |||
sub __strip_relcond { | |||
+{ | |||
map | |||
{ map { /^ (?:foreign|self) \. (\w+) $/x } ($_, $_[1]{$_}) } | |||
{ map { /^ (?:foreign|self) \. (.+) $/x } ($_, $_[1]{$_}) } |
There was a problem hiding this comment.
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 [^`|]+
.
On 11/22/2018 07:39 AM, Daniel Böhmer wrote:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In lib/DBIx/Class/ResultSource.pm
<#129 (comment)>:
> @@ -1531,7 +1531,7 @@ sub reverse_relationship_info {
sub __strip_relcond {
+{
map
- { map { /^ (?:foreign|self) \. (\w+) $/x } ($_, $_[1]{$_}) }
+ { map { /^ (?:foreign|self) \. (.+) $/x } ($_, $_[1]{$_}) }
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 |[^`|]+|.
Apologies for nto replying earlier to this. Generally there should be
*no* limitations in this specific portion of the codebase, the presence
of \w+ is an oversight, and the original PR is correct.
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 :(
I will circle back to this before the end of the year, I promise.
|
Sorry about not replying to your reply for some time. Anyway. |
Looks like postgres allows everything except NUL in column names.
|
Folks, the issue here isn't how to fix the code - I already indicated that doing 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 :( |
I should have clarified this further: the reason this particular PR was left open was detailed earlier in #129 (comment) :
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! |
1245f48
to
c11281c
Compare
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,