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

Identifiers starting with "not" inside PHQL strings are changed/suppressed #15741

Closed
marceloandrader opened this issue Oct 27, 2021 Discussed in #15694 · 1 comment
Closed
Labels
5.0 The issues we want to solve in the 5.0 release duplicate Duplicate issue. The duplicate issue is referenced in the comments

Comments

@marceloandrader
Copy link

Discussed in #15694

Originally posted by tobispace September 29, 2021
Example query:

$notificationsManual = Notification::query()
	->andWhere( 'MyNs\Models\Application\Notification.Published = 1' )
	->andWhere( 'MyNs\Models\Application\Notification.Id NOT IN ( SELECT MyNs\Models\Application\NotificationLog.NotificationId FROM MyNs\Models\Application\NotificationLog WHERE MyNs\Models\Application\NotificationLog.Active = 1 )' )
	->andWhere( 'MyNs\Models\Application\Notification.DateToSend <= :today:', [ 'today' => date( 'Y-m-d' ) . ' 23:59:59' ] )
	->execute();

This query was working on Phalcon 3.4.4 (php 7.3)

When upgrading to Phalcon 4.1.2 (php 7.4), I get this error:

Column 'ificationId' doesn't belong to the model or alias 'SHL\Models\Application\Notification', when executing: 
SELECT [MyNs\Models\Application\Notification].* 
FROM [MyNs\Models\Application\Notification] WHERE ((MyNs\Models\Application\Notification.Published = 1) 
AND (MyNs\Models\Application\Notification.Id NOT IN ( SELECT MyNs\Models\Application\NotificationLog.NotificationId 
FROM MyNs\Models\Application\NotificationLog WHERE MyNs\Models\Application\NotificationLog.Active = 1 ))) 
AND (( MyNs\Models\Application\Notification.DateToSend <= :today: ))

This seems to happen with all PHQL queries where there is an identifier starting with "not" (case insensitive).

Why??

I'm too having issues with this in a current upgrade from phalcon 3.4 to 4.1, in my case the issue is with fields like notes_id or notes_type
Here is the smallest sample that PHQL parsing is removing the 'Not' part from the Notes table name:

Screenshot from 2021-10-27 11-53-29

@stale stale bot added the stale Stale issue - automatically closed label Apr 20, 2022
@niden niden removed the stale Stale issue - automatically closed label Apr 20, 2022
@phalcon phalcon deleted a comment from stale bot Apr 20, 2022
@niden niden added duplicate Duplicate issue. The duplicate issue is referenced in the comments 5.0 The issues we want to solve in the 5.0 release labels Oct 12, 2022
@niden
Copy link
Sponsor Member

niden commented Oct 12, 2022

Duplicate of #14641

@niden niden marked this as a duplicate of #14641 Oct 12, 2022
@niden niden closed this as completed Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release duplicate Duplicate issue. The duplicate issue is referenced in the comments
Projects
Archived in project
Development

No branches or pull requests

2 participants