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

Lots of bogus errors in editor with perfectly valid query #374

Closed
php4fan opened this issue Feb 14, 2022 · 5 comments · Fixed by #388
Closed

Lots of bogus errors in editor with perfectly valid query #374

php4fan opened this issue Feb 14, 2022 · 5 comments · Fixed by #388
Assignees
Labels
Milestone

Comments

@php4fan
Copy link

php4fan commented Feb 14, 2022

Describe the bug

To Reproduce

Select a database, go to "SQL" and paste this query:

SELECT
	post.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,
	user.*, userfield.*, usertextfield.*,
	icon.title as icontitle, icon.iconpath,
	avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,
	spamlog.postid AS spamlog_postid,
	deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,
	editlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,
	editlog.reason AS edit_reason, editlog.hashistory,
	postparsed.pagetext_html, postparsed.hasimages,
	sigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,
	sigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight,
	IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
	
	, post_icon_list.icon_id_list, post_icon_list.is_auto AS icon_is_auto,
                approvedlog.modid AS approvedmodid,
		approvedlog.dateline AS approveddateline, approvedlog.status AS approvedstatus, approvedlog.info AS approvedinfo,
		movedlog.modid AS movedmodid,
		movedlog.dateline AS moveddateline, movedlog.status AS movedstatus, movedlog.info AS movedinfo,
		(
			SELECT useragent FROM session
			WHERE userid=post.userid AND lastactivity > 1644859580 ORDER BY lastactivity DESC LIMIT 1
		) AS useragent,
		IF (
			user.userid IS NOT NULL, 
			(SELECT COUNT(usernoteid) FROM usernote AS usernote 
			 WHERE usernote.userid=user.userid AND usernote.priority>=0),
			0
		) AS usernotecount
	, deletionlog.dateline AS del_dateline, scheduled_approval.defer_time AS vbpmal_approval_defer_time, additional_user_data.last_year_message_count, additional_user_data.last_year_reputation, additional_user_data.last_year_groan_count, paid_post_activation.activation_id AS paid_post_activation_id, alm_Model_UserData.credits
FROM post AS post
LEFT JOIN user AS user ON(user.userid = post.userid)
LEFT JOIN userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
LEFT JOIN icon AS icon ON(icon.iconid = post.iconid)
LEFT JOIN avatar AS avatar  ON(avatar.avatarid = user.avatarid) LEFT JOIN customavatar AS customavatar ON(customavatar.userid = user.userid)
LEFT JOIN spamlog AS spamlog ON(spamlog.postid = post.postid)
	LEFT JOIN deletionlog AS deletionlog ON(post.postid = deletionlog.primaryid AND deletionlog.type = 'post')
LEFT JOIN editlog AS editlog ON(editlog.postid = post.postid)
LEFT JOIN postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = 23 AND postparsed.languageid = 5)
LEFT JOIN sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = 23 AND sigparsed.languageid = 5)
LEFT JOIN sigpic AS sigpic ON(sigpic.userid = post.userid)
	
            LEFT JOIN vbppim_post_icon_list AS post_icon_list ON post_icon_list.post_id=post.postid
        
		LEFT JOIN vbpmal_log AS approvedlog ON (approvedlog.itemid=post.postid AND approvedlog.action='postapprove')
		LEFT JOIN vbpmal_log AS movedlog ON (movedlog.itemid=post.postid AND movedlog.action='postmove')
	
			LEFT JOIN vbpmal_scheduled_post_approval AS scheduled_approval ON scheduled_approval.post_id = post.postid
	
    LEFT JOIN vbpsmt_additional_user_data AS additional_user_data ON additional_user_data.userid=post.userid

LEFT JOIN market_pp_post_activation_mapping AS paid_post_activation ON paid_post_activation.post_id = post.postid LEFT JOIN alm_Model_UserData AS alm_Model_UserData ON alm_Model_UserData.user_id=user.userid 
WHERE post.postid IN (0,3254399,3254508,3254743,3254817,3254969,3255328,3255582,3257603,3257873,3258126,3258150,3258254,3258272,3258311,3260767,3260770,3260776,3261180,3261263,3261317,3261318)
ORDER BY post.dateline

Expected behavior

No syntax error should be shown as there is none (yes I have been able to execute this query on a database that has all the tables)

Observed behavior

(why does this stupid issue template have "expcted behavior" but not "observed behavior"?)

Lots and lots of bogus errors:

image

Here are a couple of them (I guess it could be the first one that then causes all the others in cascade):

Oh f*** I cannot copy the error message?? Well, I'll type just one:

An expression was expected. (near NOT)

Server configuration

the demo at https://demo.phpmyadmin.net/

Client configuration

  • Browser: Chrome
  • Operating system: OpenSUSE Tumbleweed
@williamdes williamdes transferred this issue from phpmyadmin/phpmyadmin Mar 5, 2022
@williamdes williamdes added the bug label Mar 5, 2022
@williamdes williamdes added this to the 5.6.0 milestone Mar 5, 2022
@williamdes
Copy link
Member

Hi @php4fan
I moved this here to the right place for it to be fixed

(why does this stupid issue template have "expcted behavior" but not "observed behavior"?)

Good question, we will think about improving the template :)

@williamdes williamdes modified the milestones: 5.6.0, 5.7.0 Nov 21, 2022
@williamdes
Copy link
Member

I think this should be added a a test case as soon as possible so when it get's fixed we can notice the difference
cc @iifawzi in case you did not know about this issue :)

williamdes added a commit that referenced this issue Nov 23, 2022
Pull-request: #388

Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes self-assigned this Nov 23, 2022
@williamdes
Copy link
Member

I tested the snapshot but for some strange reason the error still exists 🤔
What could it be @iifawzi ?

@williamdes williamdes modified the milestones: 5.7.0, 5.6.0 Nov 25, 2022
@iifawzi
Copy link
Contributor

iifawzi commented Nov 25, 2022

nice catch. it looks like and I don't know how, the test I've added 0d4e00c is missing the NOT keyword.
After adding it, the parser is still showing errors.

I will work on fixing this, the test should be updated, and a fix must be added to address the bug

image

@iifawzi
Copy link
Contributor

iifawzi commented Nov 25, 2022

Most probably, the approach I've gone with is incorrect. NOT, in that case, shouldn't be added as a statement option.
Although, the test for SELECT NOT 1 AS test is passing, this's kinda misleading.

I will work on creating a patch to fix the issue correctly and most probably revert the changes introduced at #388

williamdes added a commit that referenced this issue Nov 25, 2022
Pull-request: #391
Ref: #388

This fixes the first implementation

Signed-off-by: William Desportes <williamdes@wdes.fr>
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 a pull request may close this issue.

3 participants