module-db icon indicating copy to clipboard operation
module-db copied to clipboard

[PDOException] SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "pictograms_tags_uk-UA" does not exist

Open Yasuslik opened this issue 6 years ago • 1 comments

Hello

What are you trying to achieve?

I insert data to db (PostgreSQL) whith DB module $I->haveInDatabase("pictograms_tags_uk-UA",{"id":289,"tag_url_title":"Hello tag_url_title","description":"Hello description"})

What do you get instead?

have error [PDOException] SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "pictograms_tags_uk-ua" does not exist

Provide console output if related. Use -vvv mode for more details.

# paste output here
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Lib/Driver/Db.php:307
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Lib/Driver/PostgreSql.php:161
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Module/Db.php:748
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Module/Db.php:722
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Step.php:266
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Scenario.php:72
/var/www/project-name/tests/_support/_generated/ApiTesterActions.php:4980
/var/www/project-name/tests/_support/Helper/TestHelper.php:156
/var/www/project-name/tests/_support/Helper/TestHelper.php:71
/var/www/project-name/tests/api/Dev/DevCest.php:48
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Lib/Di.php:127
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Test/Cest.php:138
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Test/Cest.php:147
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Test/Cest.php:82
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Test/Test.php:88
/var/www/project-name/vendor/phpunit/phpunit/src/Framework/TestSuite.php:746
/var/www/project-name/vendor/codeception/phpunit-wrapper/src/Runner.php:118
/var/www/project-name/vendor/codeception/codeception/src/Codeception/SuiteManager.php:158
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Codecept.php:193
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Codecept.php:160
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Command/Run.php:502
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Command/Run.php:397
/var/www/project-name/vendor/symfony/console/Command/Command.php:255
/var/www/project-name/vendor/symfony/console/Application.php:1011
/var/www/project-name/vendor/symfony/console/Application.php:272
/var/www/project-name/vendor/symfony/console/Application.php:148
/var/www/project-name/vendor/codeception/codeception/src/Codeception/Application.php:107
/var/www/project-name/vendor/codeception/codeception/codecept:43

My debag

i use print_r in /var/www/project-name/vendor/codeception/codeception/src/Codeception/Lib/Driver/Db.php:287 and see two query

first query: [Query] INSERT INTO "pictograms_tags_uk-UA" ("id", "tag_url_title", "description") VALUES (?, ?, ?) [Parameters] [289,"Hello tag_url_title","Hello description"]

after this request comes the next SELECT a.attname FROM pg_index i JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) WHERE i.indrelid = 'pictograms_tags_uk-UA'::regclass AND i.indisprimary

Actual result: there is an error in the second request "SELECT" This query use: WHERE i.indrelid = 'pictograms_tags_uk-UA'::regclass

Expected Result if table name contain sign "-" need use double quotes WHERE i.indrelid = "pictograms_tags_uk-UA"::regclass

The first request for insert was executed correctly, the data appeared in the table, but immediately after the second request an error occurs

Details

  • Codeception version: 3.1.2 (tried version 4 have same result)
  • PHP Version: 7.1.32
  • Operating System: Debian GNU/Linux 10 (buster)
  • Installation type: Composer
  • List of installed packages (composer show)
  • Suite configuration:

P.S. Sorry for my English...

Yasuslik avatar Dec 10 '19 09:12 Yasuslik

It looks like you figured it out. Please make pull request to https://github.com/Codeception/module-db

Naktibalda avatar Dec 23 '19 17:12 Naktibalda