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

Update Question.php #1153

Closed
wants to merge 1 commit into from
Closed

Update Question.php #1153

wants to merge 1 commit into from

Conversation

st4nny
Copy link

@st4nny st4nny commented Oct 22, 2018

fix error query in group filter in listquestions view:
error from db pgsql: "operator does not exist: integer ~~ unknown"

Fixed issue # :
New feature # :
Changed feature # :
Dev:
Dev:

fix error query with filter in listquestions:
operator does not exist: integer ~~ unknown
@@ -1002,7 +1002,7 @@ public function search()
$criteria2->compare($qid_reference, $this->title, true, 'OR');

if ($this->gid != '') {
$criteria->compare('groups.gid', $this->gid, true, 'AND');
$criteria->compare('groups.gid', $this->gid, false, 'AND');
Copy link
Collaborator

Choose a reason for hiding this comment

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

See https://www.yiiframework.com/doc/api/1.1/CDbCriteria#compare-detail this change the partial match then add 1 and 10 and 11 and … if $this->gid is 1, false fixed it

Question : why it's an issue in pgsql ?

Copy link
Author

@st4nny st4nny Oct 23, 2018

Choose a reason for hiding this comment

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

Yes, pgsql want the cast of field for this expression, also we can write the criteria as some lines before

suggestion
            $gid_reference = (Yii::app()->db->getDriverName() == 'pgsql' ? ' groups.gid::varchar' : 'groups.gid');

            $criteria->compare(gid_reference, $this->gid, true, 'AND');

@dominikvitt
Copy link
Contributor

I can see this issue is already fixed, so I would close this PR.
64abf72

@dominikvitt dominikvitt closed this May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants