Read about OpenEMR's Response to the COVID-19 Pandemic at https://www.open-emr.org/covid19/

Openemr 5.0.2 Patch 2 error

Hi,

I just downloaded patch 2 today On login with openemr/sql_patch.php
I received this error:

Query Error

ERROR: query failed: UPDATE icd10_dx_order_codeSET revision = (SELECT MAX(revision) from icd10_dx_order_code) WHERE dx_code = ‘U071’

Error: You can’t specify target table ‘icd10_dx_order_code’ for update in FROM clause

/var/www/html/openemr/library/sql_upgrade_fx.php at 933:sqlStatement
/var/www/html/openemr/sql_patch.php at 66:upgradeFromSqlFile(patch.sql).

I am using LinuxMint 19.3. Patch 1 was error free.

Thanks.

Jack

I am receiving the same error on Linux mint 19.3 when trying to do the upgrade.

Richard

Hi @jackfruit501 and @Richardburt,

The issue is inside the patch.sql file Update statement is wrongly mentioned there, therefore you get that error.

Inside the patch.sql file update statement should be like below

UPDATE icd10_dx_order_code SET revision = (SELECT MAX(revision) from icd10_dx_order_code) WHERE dx_code = ‘U071’;

Thanks,
Nilesh

Hi,

Turns out this statement breaks on the less recent mariadb/mysql versions. See here for details:
OpenEMR 5.0.2 Patch
(as discussed there, luckily this doesn’t impact the patch except for not loading the covid codes; I am planning to post a fixed patch soon that does not have this issue)

-brady

1 Like

Thanks For the updated patch file.
Works perfectly now and I was able to upgrade to 5.0.2 2.

Richard

1 Like

Thanks Brady. The new patch 2 .2 worked with no error.

Jack

1 Like

Just downloaded Patch 2 and it appeared to have installed ok.
CLI_capture.txt (14.9 KB)
However, I got this screen after running the sql_patch.php


There is no 5-0-2-Patch-1.zip file in the openemr directory, only 5-0-2-Patch-2.zip

Any clues about this?

Patches are cumulative! Do an About verify (2).
Ya must have not installed patch 1…

This is a 5.0.2-1 install with Patch 1 included (or so I was told by the WIki)

Hi David, please do an About from OpenEMR top menu bar. Does it show patch(2) installed?

Nope.
About says 5.0.2-1 and confirmed in version.php
‘’’$v_major = ‘5’;
$v_minor = ‘0’;
$v_patch = ‘2’;
$v_tag = ‘’; // minor revision number, should be empty for production releases

// A real patch identifier. This is incremented when we release a patch for a
// production release. Note the above $v_patch variable is a misnomer and actually
// stores release version information.
$v_realpatch = ‘1’;’’’
Ran “a2enmod rewrite” followed by; “systemctl restart apache2”
Re-Ran patch-2 still reports it ran Patch-1

Manage Module Problem symptoms changed to 403 Forbidden (no access) so which file needs it’s permissions updated?

It just hit me, did you unzip patch in openemr root?
If not, do that and rerun sql_patch

Oh crap! so noob of me. totally lost my thought process when I got the modules error!

you nailed it. doing it now!

ummm, welcome to my world my friend!:slight_smile:

Sometimes you just need a swift kick to the head!

Patch2 done

Now just need to fix the broken Manage Modules issue.

Thank you Jerry

More than welcome. Now let’s see about you other forum thread. See ya there…

Hi Jerry

I just did first time patch installation on Linux Mint. Very easy process, and everything looks good.

Just have a question, about files needs to be removed after installation.
Please let me know if the files marked in red needs to be removed, from OpenEMR directory.

Yep those file can go. all patches will include sql_patch.php. this is for security. also pretty sure if you are finish with all upgrades, it is safe to remove sql_upgrade.php. setup.php should already be empty if I remember correctly.

We are releasing a new security patch in a couple days so, beware.

Thank you.
I removed all 3 files including sql_upgrade.
Working grate.