Skip to content

Remove FROM DUAL #159

@Yogurt4

Description

@Yogurt4

WP Version: 6.8.3
PG4WP Version: 3.4.1

Error:

----> ERROR:  syntax error at or near "VALUES"
LINE 3: WHERE ( SELECT NULL FROM DUAL ) IS NULL RETURNING * VALUES
                                                            ^

RAW SQL

INSERT INTO wp_actionscheduler_actions ( `hook`, `status`, `scheduled_date_gmt`, `scheduled_date_local`, `schedule`, `group_id`, `priority`, `args` )
SELECT 'aioseo_ai_update_credits', 'pending', '2025-10-08 14:16:58', '2025-10-08 14:16:58', 'O:32:"ActionScheduler_IntervalSchedule":5:{s:22:"', 1, 10, '[]' FROM DUAL
WHERE ( SELECT NULL FROM DUAL ) IS NULL

Expected Rewritten SQL

INSERT INTO wp_actionscheduler_actions ( hook, status, scheduled_date_gmt, scheduled_date_local, schedule, group_id, priority, args )
SELECT 'aioseo_ai_update_credits', 'pending', '2025-10-08 14:16:58', '2025-10-08 14:16:58', 'O:32:"ActionScheduler_IntervalSchedule":5:{s:22:"', 1, 10, '[]' 
WHERE ( SELECT NULL ) IS NULL RETURNING *

Actual Rewritten SQL

INSERT INTO wp_actionscheduler_actions ( hook, status, scheduled_date_gmt, scheduled_date_local, schedule, group_id, priority, args )
SELECT 'aioseo_ai_update_credits', 'pending', '2025-10-08 14:16:58', '2025-10-08 14:16:58', 'O:32:"ActionScheduler_IntervalSchedule":5:{s:22:"', 1, 10, '[]' FROM DUAL
WHERE ( SELECT NULL FROM DUAL ) IS NULL RETURNING * VALUES

MySQL's FROM DUAL can be removed completely.

Also remove VALUES from the end. (This may get fixed automatically with the removal of FROM DUALs.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions