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

Adding DB Column via Query Form results in Duplicate Column exception #180

Closed
obfuscode opened this issue Apr 16, 2019 · 1 comment
Closed
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Comments

@obfuscode
Copy link
Contributor

obfuscode commented Apr 16, 2019

Description of the problem
If you try to add a DB column via the Utilities > Query Form, the column is added but EE throws a Duplicate Column exception.

How To Reproduce
Steps to reproduce the behavior:

  1. Paste this into your Query Form:
ALTER TABLE `exp_cp_log` ADD COLUMN `testing` text NULL;
  1. Submit Query

Error Messages


SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'testing3':
ALTER TABLE `ee5testing`.`exp_cp_log` ADD COLUMN `testing3` text NULL

ee/legacy/database/drivers/mysqli/mysqli_connection.php:117

Stack Trace: Please include when reporting this error

#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('ALTER TABLE `ee...')
#1 ee/legacy/database/DB_driver.php(270): CI_DB_mysqli_driver->_execute('ALTER TABLE `ee...')
#2 ee/legacy/database/DB_driver.php(180): CI_DB_driver->simple_query('ALTER TABLE `ee...')
#3 ee/EllisLab/ExpressionEngine/Controller/Utilities/Query.php(191): CI_DB_driver->query('ALTER TABLE `ee...')
#4 ee/EllisLab/ExpressionEngine/Controller/Utilities/Query.php(47): EllisLab\ExpressionEngine\Controller\Utilities\Query->runQuery()
#5 [internal function]: EllisLab\ExpressionEngine\Controller\Utilities\Query->index()
#6 ee/EllisLab/ExpressionEngine/Core/Core.php(241): call_user_func_array(Array, Array)
#7 ee/EllisLab/ExpressionEngine/Core/Core.php(110): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#8 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#9 admin.php(153): require_once('...')

Environment Details:

  • Version: 5.2.2
  • PHP Version: 7.1
  • MySQL Version: 8.0.12
  • OS: macOS
  • Web Server: nginx

Additional context
If the column exists before you run the query, you get EE's clean error alert:

Attention: Query not run

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'testing3':<br> ALTER TABLE `ee5testing`.`exp_cp_log` ADD COLUMN `testing3` text NULL
@obfuscode
Copy link
Contributor Author

Actually, it looks like all queries in the Query Form are being submitted at least 3 times. Running this query inserts 3 rows!

INSERT INTO `exp_cp_log` (site_id, member_id, username, act_date, ip_address, action, testing) VALUES (1, 1, 'admin', 1555421516, '127.0.0.1', 'Testing', 'This is a test');

@Jordan-Ellis Jordan-Ellis added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Apr 17, 2019
derekjones pushed a commit that referenced this issue May 27, 2019
* Clear patch changelog

And minor changelog since a patch item was accidentally added to it

* Removed requirement for content in template partials.

* Fixed a bug where the template editor would not highlight EE comment tags correctly on newlines

Fixes #86

* Fixing a typo

Fixes #181

* Revert "Fixing a typo"

This reverts commit 204b31b.

* Fixed a bug where the Query Form would run a query two extra times

Fixes #180

* Made the member import password hashing consistent with the Auth library.

* Altered password change notifications related to hash algorithm changes.

* url_encoded the control panel login return, as redirects were not always decodable.

* If a relationship tag has a modifier, it is not an open node.

Fixes #182

* Better handling for category parameters

* Fixed a bug in the spam module where approving a Channel Entry that has categories generated PHP errors.

* Clarified language describing channel (#204)

* Clarified language describing channel

The pull request hopes to fix issue #203 .Thank you!

* proper noun for Channels

In this setting, speaking about the feature and not only the concept, the proper noun seems appropriate.

* Update AUTHORS.md

* Update a few EllisLab copyright refs

* Get rid of Disallowed Key Characters

Fixes #210
This type of protection isn't necessary with register_globals no longer existing in supported versions of PHP

* Don't filter GET data for PHP naughtiness

Just don't ever use user input in an executable context. Some browsers already block this too.

Actually fixes #210

* move changelog to the docs

ExpressionEngine/ExpressionEngine-User-Guide@2b3f1e5

* add 5.2.3 update file
intoeetive pushed a commit that referenced this issue Oct 27, 2021
EECORE-38 fix links on dropdowns in custom menus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.
Projects
None yet
Development

No branches or pull requests

2 participants