-
Notifications
You must be signed in to change notification settings - Fork 122
Fixed invalid quoting for postgresql adapter #162
base: master
Are you sure you want to change the base?
Conversation
…ction needed. Could mock yet more methods and possible return values, but there is already a facility for stubbing instead using TrustedPlatform. Also fix quoting and elaborate on test values.
Assisting with your sequence PR
@@ -89,7 +89,7 @@ public function nextSequenceId() | |||
$sql = 'SELECT ' . $platform->quoteIdentifier($this->sequenceName) . '.NEXTVAL as "nextval" FROM dual'; | |||
break; | |||
case 'PostgreSQL': | |||
$sql = 'SELECT NEXTVAL(\'"' . $this->sequenceName . '"\')'; | |||
$sql = 'SELECT NEXTVAL(\'' . $platform->quoteIdentifierChain($this->sequenceName) . '\')'; |
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.
change to:
$sql = 'SELECT NEXTVAL(' . $platform->quoteValue($platform->quoteIdentifierChain($this->sequenceName)) . ')';
@@ -117,7 +117,7 @@ public function lastSequenceId() | |||
$sql = 'SELECT ' . $platform->quoteIdentifier($this->sequenceName) . '.CURRVAL as "currval" FROM dual'; | |||
break; | |||
case 'PostgreSQL': | |||
$sql = 'SELECT CURRVAL(\'' . $this->sequenceName . '\')'; | |||
$sql = 'SELECT CURRVAL(\'' . $platform->quoteIdentifierChain($this->sequenceName) . '\')'; |
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.
change to:
$sql = 'SELECT CURRVAL(' . $platform->quoteValue($platform->quoteIdentifierChain($this->sequenceName)) . ')';
Just in case maintainers deem necessary to fix this before I am done with my overly prolonged enterprise of making sequences feature complete, I would suggest that at least this PR should be fixed in
Two reasons:
If any queries are done manually they should be done using prepared statements to avoid overload on database engines to recreate execution plan for multitude of similar queries. |
@ezimuel yes |
Maybe instead of closing it You can simply accept it (for now)? It does not interfere with anything else and it's strange, that so simple one-liner was not reviewed and fixed for over a year. All signs in the sky and earth indicate that the next few months / years will pass before someone approves the @alextech fixes. |
@xorock fair enough, if ever get back to my stuff I can always rebase (as part of relearning process I would have to undergo at that point anyway) However!, this business of quoteIdentifierChain vs quoteIdentifier Edit--- n/m quoteValue is unrelated to identifier chain. I meant to say identifier vs identifierChain which I think fixes inconsistencies you reported when using schema names. Edit2. I saw a nice blog post just coming out promising these new features, so lets just use that as motivation for focusing on solving the architecture difficulties :) zend team really is busy. |
@xorock —
This sort of comment is not helpful, and disrespectful to the people maintaining the library. Please review our code of conduct, specifically points 5-7. While I understand your frustration with a patch not being merged on a time schedule convenient to yourself, please be aware that we have around 200 components and modules to maintain, with only a couple dozen (mostly volunteer) people with commit rights. Please respect their efforts and time. |
Sorry @weierophinney but I think disrespectful was when @alextech put a lot of effort into creating tests and fixing entire system and ezimuel just closed it: #187 (comment). I fully understand how much components You are maintaining, I'm with ZF from ~v0.7 but also I think zend-db is one of the most important elements of the entire framework and should be patched much faster. As Your team noticed https://framework.zend.com/blog/2017-12-06-zend-db-2.9.0.html?utm_source=dlvr.it&utm_medium=twitter "This is our first new feature release in over 18 months". |
Yes this was a mistake in a hurry, but the PR is open and nothing is lost.
Sorry, but that's only your feeling. Compare with the number of downloads on packagist.org: https://packagist.org/?q=zend |
Funny thing is we're not discussing how to improve zend-db but other unimportant things. Truth is, both schemas and aliases (if I remember well Matthew noticed this bug ~3years ago, for example try to alias table and then DELETE something) needs to be rewritten. We should think how to do this. As You know, packagist show statistics for all downloads. If You check requirements for zend-mvc, zend-form and zend-expressive You will know why these and not other packages are at the first place in statistics. zend-db is required manually. |
This repository has been moved to laminas/laminas-db. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#98. |
As described in #161