Sql error 1109

Every time I try to make a mysqldump I get the following error: $> mysqldump --single-transaction --host host -u user -p db > db.sql mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXT...

Every time I try to make a mysqldump I get the following error:

$> mysqldump --single-transaction --host host -u user -p db > db.sql
mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM,
'$."number-of-buckets-specified"') FROM
information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'db' AND
TABLE_NAME = 'Absence';':
Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

The result is a dump which is not complete. The strange thing is that the same command, executed from another host, works without throwing any errors. Did someone experienced the same problem?

I’m using mysql-client 8.0 and try to access a mysql 5-7 server — maybe that is the reason?

asked May 14, 2018 at 16:40

manifestor's user avatar

manifestormanifestor

5,7096 gold badges25 silver badges36 bronze badges

This is due to a new flag that is enabled by default in mysqldump 8.
You can disable it by adding --column-statistics=0. The command will be something like:

mysqldump --column-statistics=0 --host=<server> --user=<user> --password=<password> 

Check this link for more information. To disable column statistics by default, you can add

[mysqldump]
column-statistics=0

to a MySQL config file, go to /etc/my.cnf, ~/.my.cnf, or directly to /etc/mysql/mysql.cnf.

questionto42's user avatar

answered May 17, 2018 at 13:10

cristhiank's user avatar

cristhiankcristhiank

7,8041 gold badge6 silver badges4 bronze badges

9

For those using MySQL Workbench, there is an «Advanced Options» button on the Data Export screen. The option «Use Column Statistics» can be disabled by setting to 0.

I have not confirmed, but the following information has been suggested to also be true:
In Version 8.0.14 it’s missing.
In Version 8.0.16 it’s doing this by default.

answered Oct 25, 2018 at 22:57

atjoedonahue's user avatar

15

I spent the whole day looking for a solution, and signed up here just to share mine.

Yes, this error is due to version differences.

Just download the MySQL 5.7 ZIP Archive from here: https://dev.mysql.com/downloads/mysql/ and unzip it, then use the mysqldump.exe file from there.

If you are using MySQL Workbench, you will need to set a path to the mysqldump Tool you downloaded by going to Edit -> Preferences -> Administration (from left hand pane).

Hope this helps.

Community's user avatar

answered May 15, 2018 at 15:32

DodiX's user avatar

DodiXDodiX

4113 silver badges4 bronze badges

5

I know that I am late to the party but this was getting me crazy.
If you want to use a recent MySQL Workbench (tried with the newest one as of today, MySQL Workbench 8.0.20) you can patch this file:

plugins/wb_admin_export_options.py

in macOS: (/Applications/MySQLWorkbench.app/Contents/Resources/plugins/wb_admin_export_options.py)
Replacing this line:

  "column-statistics":["Writing ANALYZE TABLE statements to generate statistics histograms.", "FALSE", "BOOL", ("8.0.2", None)]

with this one:

"column-statistics":["Writing ANALYZE TABLE statements to generate statistics histograms (set 0 to disable).", "1", "INT", (None, None)]

Then remove the .pyo:

rm /Applications/MySQLWorkbench.app/Contents/Resources/plugins/wb_admin_export_options.pyo

Finally, reload Workbench again and in the Data Export page, click on «Advanced options…» and you will see the column-statistics option again (set 0 to disable and click the Return button)

enter image description here

Note: you can download the patched file from this Gist.

answered May 3, 2020 at 15:58

Juanan's user avatar

JuananJuanan

2813 silver badges7 bronze badges

7

Easiest Work Around

When using Mysql Workbench 8.0

Best of luck!

answered Dec 13, 2018 at 7:10

anson's user avatar

ansonanson

1811 silver badge2 bronze badges

5

To make this answer easier, you can rename mysqldump, make a shell script in its place and call the renamed mysqldump with the --column-statistics=0 argument. Eg:

Rename mysqldump:

mv /usr/local/bin/mysqldump /usr/local/bin/_mysqldump

Save the following shell script in its place:

#!/bin/sh

_mysqldump --column-statistics=0 $@

answered Jul 4, 2018 at 5:25

pierlo's user avatar

3

In addittion to pierlo https://serverfault.com/a/919403/586669

From within MySQL Workbench there is an option to set the path of the mysqldump executable.
(Edit — Preferences — Administration)

So you can create a .cmd (on Windows) or a .sh file (on Linux or mac) as follows:

mysqldump_nostatistics.cmd:

 @ECHO OFF
 "C:Program FilesMySQLMySQL Workbench 8.0 CEmysqldump.exe" %*  --column-statistics=0

mysqldump_nostatistics.sh:

#!/bin/sh

_mysqldump $@ --column-statistics=0

Note the order of the parameters (it is different from pierlo’s) : the dump command executed includes (or may include) a --defaults-file= option, and this has to be the first parameter.

Also The echo off is needed otherwise the workbench is unable to parse the command output correctly.

answered Aug 4, 2020 at 11:40

Ronald's user avatar

RonaldRonald

511 silver badge1 bronze badge

1

I had this problem using the latest mysql workbench (8.0.23) on OSX (11.1) with mariadb.
I solved it by selecting the version of mysqldump found in the mariadb package.

/usr/local/mariadb/mariadb-10.1.37-osx10.13-x86_64/bin/mysqldump

answered Feb 1, 2021 at 20:40

Paul Collister's user avatar

2

I use XAMPP and MySQL Workbench does warn about a version mismatch. I set MySQL Workbench to point to the XAMPP’s mysql.exe and mysqldump.exe.

Go to Edit -> Preferences -> Administration and set the path for each.

This works at least for version 8.0.14. So for others you may want to avoid using the bundled version of mysql and mysqldump.

answered Jan 23, 2019 at 23:04

Dean Or's user avatar

Dean OrDean Or

2131 gold badge2 silver badges5 bronze badges

4

There a couple of answers above here that refer to renaming the mysqldump binary and creating a wrapper script. This is a terrible approach.

The correct method (in bash) is to alias the command in your .bashrc

alias mysqldump="mysqldump --column-statistics=0"

answered Sep 20, 2021 at 13:17

stridebird's user avatar

From MySQL Workbench version 8.0.14 you don’t have the option to disable column-statistics

You can do that in version 8.0.13

But you have an option to do it by enabling delete-master-logs in version 8.0.22

  • --delete-master-logs has the same effect as the RESET MASTER SQL command.
  • RESET MASTER deletes all binary log files listed in the index file, resets the binary log index file to be empty, and creates a new binary log file. This statement is intended to be used only when the master is started for the first time.

mforsetti's user avatar

mforsetti

2,5362 gold badges16 silver badges20 bronze badges

answered Nov 16, 2020 at 9:42

Nob Hokleng's user avatar

For those using DBeaver check the Local Client is set to create the dump. See next images for reference:

Access to local client selection:

Access to local client selection

Local clients available:

Local clients available

Uwe Keim's user avatar

Uwe Keim

2,3804 gold badges29 silver badges46 bronze badges

answered Dec 18, 2020 at 10:15

Dario Herrero's user avatar

I faced the same issue with MySQL workbench latest edition, I resolved it using the mysqldump command line

C:Program FilesMySQLMySQL Workbench 8.0 CEmysqldump --column-statistics=0  --user=USERNAME --host=REMOTE_HOST --protocol=tcp --port=3306 --default-character-set=utf8 DATABASE_NAME > c:tempdump.sql --password

Replace USERNAME, REMOTE_HOST, DATABASE_NAME with your names.

answered Jan 6, 2021 at 11:11

Hany Sakr's user avatar

Depending on your situation, you can get rid of mysql and install mariadb instead. This eliminates the new feature that was introduced in mysql 8.

answered Sep 7, 2021 at 19:01

Edward Ned Harvey's user avatar

1

In my situation, I’m using mac-OS. By the way, there was [mysqldump]
column-statistics=0
fields in my.cnf file that is placed under the /usr/local/etc directory. Deleting that field fixed the issue. (not: mysql version is 5.7 and installed via homebrew).

Cory Knutson's user avatar

answered Dec 11, 2018 at 13:04

Hatip Aksunger's user avatar

I also had the same issue, it occurs when I merge multiple data tables to the existing schema from other schema and export merged data to self contained script file. I did try to change the column-statistics=0,but result was following,

C:xamppmysqlbin>mysqldump --column-statistics=0 --host=loalhost --user root --passwod
mysqldump: unknown variable 'column-statistics=0'

So I hadn’t help. I analyze the MySQL log I found that

2019-01-21 11:31:30 1050 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2019-01-21 11:31:30 4176 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

its complaining about the size of the innodb_buffer_pool_size. I did make it to 24MB. Then it works.

Thomas's user avatar

Thomas

4,1955 gold badges21 silver badges28 bronze badges

answered Jan 21, 2019 at 7:23

Rasike Abeyratne's user avatar

On macOS I fixed this by overriding the bundled mysqldump:

  1. Install mariadb, e.g. brew install mariadb
  2. Navigate to MySQLWorkbench > Preferences > Administration
  3. Set the mysqldump path to the one you just installed, e.g. /opt/homebrew/bin/mysqldump

Note: to find the full path to mysqldump, you can run which mysqldump in your terminal.

answered Oct 24, 2021 at 21:31

jchook's user avatar

jchookjchook

1215 bronze badges

Since i cannot comment the actual answer from user:cristhiank, i’m adding a slight variation of the actual answer. In my case i had to change it in /etc/my.cnf.d/client.cnf and i had to leave it in the [client] section so not adding a [mysqldump] section.

So for me this was working /etc/my.cnf.d/client.cnf

[client]
column-statistics=0

answered May 18, 2022 at 15:29

trainin99's user avatar

In MySQL Workbench 8.0.31 on Advanced Options tab now exists new option «Force«, use it to skip errors like mentioned above.

answered Nov 8, 2022 at 12:27

Roman's user avatar

For Ansible users use:

mysql_db:
 ...
 dump_extra_args: --column-statistics=0

In my case it ignores ~/.my.cnf and /etc/my.cnf

answered Dec 2, 2022 at 14:28

Ricky Levi's user avatar

If using a MariaDB backend with MySQL Workbench 8.0.31 CE use need to download the native MariaDB binaries for your system from https://mariadb.com/downloads/community/ and specify them in MySQL Workbench.

For example, if you are on 64-bit Microsoft Windows OS perform the following:

  1. Goto https://mariadb.com/downloads/community/
  2. On the above page, select your Operating System
  3. Community Server —> Verison (latest GA) —> OS (MS Windows 64-bit) and click on download
  4. Run the Install Shield just downloaded, and make sure «MariaDB Server -> Client Programs» is enabled.
  5. Run up MySQL Workbench
  6. Select the menu: Edit -> Preferences…
  7. Select «Administration» in the left hand column
  8. Update «Path to mysqldump Tool:» to be C:Program FilesMariaDB 10.10binmariadb-dump.exe
  9. Update «Path to mysql Tool:» to be C:Program FilesMariaDB
    10.10binmariadb.exe

No more performance statistic errors or any other divergent issues down the line between MySQL and MariaDB.

This has been posted for future reference.

answered Dec 6, 2022 at 19:44

Elstone IT Services Limited's user avatar

I’m using PHP and MySQL(Server version: 5.5.31-0ubuntu0.12.04.2) for my website when I run the following query it’s giving me the above error. I couldn’t get any clue behind this error. Can anyone help me in resolving this error and suggesting the changes if any to my existing query? For your reference I’m writing my query below:

DELETE
   ABC.theory_sheet_set,
   ABC.theory_sheet_questions
FROM
   ABC.theory_sheet_set AS theory_sheet_set,
   OCN.theory_sheet_questions AS theory_sheet_questions
WHERE
   theory_sheet_set.theory_sheet_set_id = theory_sheet_questions.theory_sheet_set_id
   AND theory_sheet_set.theory_sheet_id=".$theory_sheet_id

The error it gives is as follows:

MySQL Error: 1109 (Unknown table 'theory_sheet_set' in MULTI DELETE)
Session halted.

My database name is ABC. Actually all the table names are valid and all the tables involved in this query are present there into the database. Can you please help me in resolving this issue?

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

asked Aug 21, 2013 at 6:28

PHPLover's user avatar

1

If you use the alias names used later into the query at the beginning of of query(i.e. right after the word DELETE) then it will work finely. The only issue there was that it couldn’t be able to identify the table from your database as you have used alias names to refer those tables into your database. So in order to remove this bug you must use alias name s you used in the query after DELETE. The rectified query will look like following:

DELETE theory_sheet_set, theory_sheet_questions FROM ABC.theory_sheet_set AS theory_sheet_set, ABC.theory_sheet_questions AS theory_sheet_questions  WHERE theory_sheet_set.theory_sheet_set_id=theory_sheet_questions.theory_sheet_set_id AND  theory_sheet_set.theory_sheet_id="$theory_sheet_id

answered Aug 21, 2013 at 6:53

PHPLover's user avatar

PHPLoverPHPLover

7,69337 gold badges102 silver badges190 bronze badges

there are syntax error, try on this

DELETE *
FROM
theory_sheet_set theory_sheet_set
INNER JOIN 
theory_sheet_questions theory_sheet_questions ON  
theory_sheet_set.theory_sheet_set_id = theory_sheet_questions.theory_sheet_set_id
WHERE theory_sheet_set.theory_sheet_id=".$theory_sheet_id

answered Aug 21, 2013 at 6:50

Low Chee Mun's user avatar

Low Chee MunLow Chee Mun

6101 gold badge4 silver badges9 bronze badges

Вопрос:

Я использую PHP и MySQL (версия сервера: 5.5.31-0ubuntu0.12.04.2) для моего сайта, когда я запускаю следующий запрос, который дает мне вышеуказанную ошибку. Я не мог понять эту ошибку. Может ли кто-нибудь помочь мне в разрешении этой ошибки и предложить изменения, если они есть, в моем существующем запросе? Для вашей справки я пишу свой запрос ниже:

DELETE
ABC.theory_sheet_set,
ABC.theory_sheet_questions
FROM
ABC.theory_sheet_set AS theory_sheet_set,
OCN.theory_sheet_questions AS theory_sheet_questions
WHERE
theory_sheet_set.theory_sheet_set_id = theory_sheet_questions.theory_sheet_set_id
AND theory_sheet_set.theory_sheet_id=".$theory_sheet_id

Ошибка, которую он дает, выглядит следующим образом:

MySQL Error: 1109 (Unknown table 'theory_sheet_set' in MULTI DELETE)
Session halted.

Имя моей базы данных – ABC. Фактически все имена таблиц действительны, и все таблицы, участвующие в этом запросе, присутствуют там в базе данных. Не могли бы вы помочь мне в решении этой проблемы?

Ответ №1

Если вы используете имена псевдонимов, используемые позже в запросе в начале запроса (т.е. сразу после слова DELETE), он будет работать точно. Единственная проблема заключалась в том, что он не смог определить таблицу из вашей базы данных, поскольку вы использовали имена псевдонимов, чтобы ссылаться на эти таблицы в своей базе данных. Поэтому, чтобы удалить эту ошибку, вы должны использовать имя псевдонима s, которое вы использовали в запросе после DELETE. Выбранный запрос будет выглядеть следующим образом:

DELETE theory_sheet_set, theory_sheet_questions FROM ABC.theory_sheet_set AS theory_sheet_set, ABC.theory_sheet_questions AS theory_sheet_questions  WHERE theory_sheet_set.theory_sheet_set_id=theory_sheet_questions.theory_sheet_set_id AND  theory_sheet_set.theory_sheet_id="$theory_sheet_id

Ответ №2

есть синтаксическая ошибка, попробуйте это

DELETE *
FROM
theory_sheet_set theory_sheet_set
INNER JOIN
theory_sheet_questions theory_sheet_questions ON
theory_sheet_set.theory_sheet_set_id = theory_sheet_questions.theory_sheet_set_id
WHERE theory_sheet_set.theory_sheet_id=".$theory_sheet_id

I am having the same error here. Sadly —with «no foreign keys» does not change the output.
$ pgloader --with "no foreign keys" --debug mysql://renate:password@localhost/renate_with_spree postgresql:///renate_with_spree

WARNING: Setting locale failed.
  Check the following variables for correct values:
  LC_MONETARY=de_CH.UTF-8
  LC_NUMERIC=de_CH.UTF-8
  LC_TIME=de_CH.UTF-8
sb-impl::*default-external-format* :UTF-8
tmpdir: #P"/tmp/pgloader/"
2018-02-17T10:49:31.049000Z NOTICE Starting pgloader, log system is ready.
2018-02-17T10:49:31.077000Z INFO Starting monitor
2018-02-17T10:49:31.085000Z LOG Main logs in '/tmp/pgloader/pgloader.log'
2018-02-17T10:49:31.085000Z LOG Data errors in '/tmp/pgloader/'
2018-02-17T10:49:31.086000Z INFO SOURCE: #<PGLOADER.MYSQL:MYSQL-CONNECTION mysql://renate@localhost:3306/renate_with_spree {1008CF6D73}>
2018-02-17T10:49:31.089000Z INFO TARGET: #<PGLOADER.PGSQL:PGSQL-CONNECTION pgsql://rails@UNIX:5432/renate_with_spree {1008EF25C3}>
2018-02-17T10:49:31.089000Z DEBUG LOAD DATA FROM #<PGLOADER.MYSQL:MYSQL-CONNECTION mysql://renate@localhost:3306/renate_with_spree {1008CF6D73}>
2018-02-17T10:49:31.090000Z DEBUG CONNECTED TO #<PGLOADER.PGSQL:PGSQL-CONNECTION pgsql://rails@UNIX:5432/renate_with_spree {1008EF25C3}>
2018-02-17T10:49:31.290000Z DEBUG CONNECTED TO #<MYSQL-CONNECTION mysql://renate@localhost:3306/renate_with_spree {1008CF6D73}>
2018-02-17T10:49:31.290000Z DEBUG MySQL: sending query: 
  select c.table_name, c.column_name,
         c.data_type, c.column_type, c.column_default,
         c.is_nullable, c.extra
    from information_schema.columns c
         join information_schema.tables t using(table_schema, table_name)
   where c.table_schema = 'renate_with_spree' and t.table_type = 'BASE TABLE'
         
         
         
order by table_name, ordinal_position
2018-02-17T10:49:31.691000Z DEBUG MySQL: sending query: 
    SELECT table_name, table_comment
      FROM information_schema.tables
    WHERE     table_schema = 'renate_with_spree'
          and table_type = 'BASE TABLE'
         
         
         
2018-02-17T10:49:31.891000Z DEBUG MySQL: sending query: 
  select c.table_name, c.column_name, c.column_comment
    from information_schema.columns c
         join information_schema.tables t using(table_schema, table_name)
   where     c.table_schema = 'renate_with_spree'
         and t.table_type = 'BASE TABLE'
         
         
         
order by table_name, ordinal_position
An unhandled error condition has been signalled:
   MySQL Error [1109]: "Unknown table 'referential_constraints' in information_schema"

Date/time: 2018-02-17-10:49An unhandled error condition has been signalled:
                              MySQL Error [1109]: "Unknown table 'referential_constraints' in information_schema"


Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1008B846C3}>
0: ((LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX))
1: (SB-IMPL::CALL-WITH-SANE-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX) {100AA7A5DB}>)
2: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX) {100AA7A5AB}>)
3: (PRINT-BACKTRACE :STREAM #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {10002C3A43}> :START 0 :FROM :DEBUGGER-FRAME :COUNT 4611686018427387903 :PRINT-THREAD T :PRINT-FRAME-SOURCE NIL :METHOD-FRAME-STYLE NIL)
4: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE-TO-STREAM #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {10002C3A43}>)
5: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE #<QMYND:MYSQL-ERROR {100AA76083}> :OUTPUT #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {10002C3A43}> :IF-EXISTS :APPEND :VERBOSE T)
6: (SIGNAL #<QMYND:MYSQL-ERROR {100AA76083}>)
7: (ERROR #<QMYND:MYSQL-ERROR {100AA76083}>)
8: (QMYND-IMPL:PARSE-RESPONSE #<QMYND-IMPL::MY-PACKET-STREAM 70/70 [2]>)
9: (QMYND:MYSQL-QUERY #<QMYND-IMPL::MYSQL-INET-CONNECTION {1009EE9DF3}> "
    SELECT tc.table_name, tc.constraint_name, k.referenced_table_name ft,

           group_concat(         k.column_name
                        order by k.ordinal_position) as cols,

           group_concat(         k.referenced_column_name
                        order by k.position_in_unique_constraint) as fcols,

           rc.update_rule, rc.delete_rule

      FROM information_schema.table_constraints tc

           JOIN information_schema.referential_constraints rc
             ON rc.constraint_schema = tc.table_schema
            AND rc.constraint_name = tc.constraint_name
            AND rc.table_name = tc.table_name

      LEFT JOIN information_schema.key_column_usage k
             ON k.table_schema = tc.table_schema
            AND k.table_name = tc.table_name
            AND k.constraint_name = tc.constraint_name

    WHERE     tc.table_schema = 'renate_with_spree'
          AND k.referenced_table_schema = 'renate_with_spree'
          AND tc.constraint_type = 'FOREIGN KEY'
         
         
         

 GROUP BY tc.table_name, tc.constraint_name, ft" :ROW-FN NIL :AS-TEXT T :RESULT-TYPE LIST)
10: (PGLOADER.MYSQL::LIST-ALL-FKEYS :ONLY-TABLES NIL :INCLUDING NIL :EXCLUDING NIL)
11: (PGLOADER.MYSQL::FETCH-MYSQL-METADATA #<PGLOADER.MYSQL:COPY-MYSQL {10098ED113}> :STATE #S(PGLOADER.UTILS::PGSTATE :TABLES #<HASH-TABLE :TEST EQUAL :COUNT 1 {100908C783}> :TABNAMES ("fetch meta data") :READ 0 :ROWS 0 :ERRS 0 :SECS 0.0) :MATERIALIZE-VIEWS NIL :ONLY-TABLES NIL :INCLUDING NIL :EXCLUDING NIL)
12: ((:METHOD PGLOADER.SOURCES:COPY-DATABASE (PGLOADER.MYSQL:COPY-MYSQL)) #<PGLOADER.MYSQL:COPY-MYSQL {10098ED113}> :STATE-BEFORE #S(PGLOADER.UTILS::PGSTATE :TABLES #<HASH-TABLE :TEST EQUAL :COUNT 1 {100908C783}> :TABNAMES ("fetch meta data") :READ 0 :ROWS 0 :ERRS 0 :SECS 0.0) :STATE-AFTER #S(PGLOADER.UTILS::PGSTATE :TABLES #<HASH-TABLE :TEST EQUAL :COUNT 0 {100908D503}> :TABNAMES NIL :READ 0 :ROWS 0 :ERRS 0 :SECS 0.0) :STATE-INDEXES #S(PGLOADER.UTILS::PGSTATE :TABLES #<HASH-TABLE :TEST EQUAL :COUNT 0 {100908D083}> :TABNAMES NIL :READ 0 :ROWS 0 :ERRS 0 :SECS 0.0) :TRUNCATE NIL :DISABLE-TRIGGERS NIL :DATA-ONLY NIL :SCHEMA-ONLY NIL :CREATE-TABLES T :INCLUDE-DROP T :CREATE-INDEXES T :INDEX-NAMES :UNIQUIFY :RESET-SEQUENCES T :FOREIGN-KEYS NIL :ONLY-TABLES NIL :INCLUDING NIL :EXCLUDING NIL :DECODING-AS NIL :MATERIALIZE-VIEWS NIL) [fast-method]
13: ((LAMBDA ()))
14: (PGLOADER:RUN-COMMANDS (LAMBDA NIL (LET* ((PGLOADER.PARSER::STATE-BEFORE (PGLOADER.UTILS:MAKE-PGSTATE)) (PGLOADER.PARAMS:*STATE* (OR PGLOADER.PARAMS:*STATE* (PGLOADER.UTILS:MAKE-PGSTATE))) (PGLOADER.PARSER::STATE-IDX (PGLOADER.UTILS:MAKE-PGSTATE)) (PGLOADER.PARSER::STATE-AFTER (PGLOADER.UTILS:MAKE-PGSTATE)) (PGLOADER.SOURCES:*DEFAULT-CAST-RULES* (QUOTE ((:SOURCE (:TYPE #1="int" :AUTO-INCREMENT T :TYPEMOD (< PGLOADER.TRANSFORMS:PRECISION 10)) :TARGET (:TYPE #2="serial")) (:SOURCE (:TYPE #1# :AUTO-INCREMENT T :TYPEMOD (<= 10 PGLOADER.TRANSFORMS:PRECISION)) :TARGET (:TYPE #3="bigserial")) (:SOURCE (:TYPE #1# :AUTO-INCREMENT NIL :TYPEMOD (< PGLOADER.TRANSFORMS:PRECISION 10)) :TARGET (:TYPE #1#)) (:SOURCE (:TYPE #1# :AUTO-INCREMENT NIL :TYPEMOD (<= 10 PGLOADER.TRANSFORMS:PRECISION)) :TARGET (:TYPE #4="bigint")) (:SOURCE (:TYPE #5="tinyint" :AUTO-INCREMENT T) :TARGET (:TYPE #2#)) (:SOURCE (:TYPE #6="smallint" :AUTO-INCREMENT T) :TARGET (:TYPE #2#)) (:SOURCE (:TYPE #7="mediumint" :AUTO-INCREMENT T) :TARGET (:TYPE #2#)) (:SOURCE (:TYPE #4# :AUTO-INCREMENT T) :TARGET (:TYPE #3#)) (:SOURCE (:TYPE #5# :TYPEMOD (= 1 PGLOADER.TRANSFORMS:PRECISION)) :TARGET (:TYPE #8="boolean" :DROP-TYPEMOD T) :USING PGLOADER.TRANSFORMS::TINYINT-TO-BOOLEAN) (:SOURCE (:TYPE "bit" :TYPEMOD (= 1 PGLOADER.TRANSFORMS:PRECISION)) :TARGET (:TYPE #8# :DROP-TYPEMOD T) :USING PGLOADER.TRANSFORMS::BITS-TO-BOOLEAN) (:SOURCE (:TYPE #4# :TYPEMOD (< 19 PGLOADER.TRANSFORMS:PRECISION)) :TARGET (:TYPE #9="numeric" :DROP-TYPEMOD T)) (:SOURCE (:TYPE #5#) :TARGET (:TYPE #6# :DROP-TYPEMOD T)) (:SOURCE (:TYPE #6#) :TARGET (:TYPE #6# :DROP-TYPEMOD T)) (:SOURCE (:TYPE #7#) :TARGET (:TYPE #10="integer" :DROP-TYPEMOD T)) (:SOURCE (:TYPE #10#) :TARGET (:TYPE #10# :DROP-TYPEMOD T)) (:SOURCE (:TYPE #11="float") :TARGET (:TYPE #11# :DROP-TYPEMOD T)) (:SOURCE (:TYPE #4#) :TARGET (:TYPE #4# :DROP-TYPEMOD T)) (:SOURCE (:TYPE "double") :TARGET (:TYPE "double precision" :DROP-TYPEMOD T)) (:SOURCE (:TYPE #9#) :TARGET (:TYPE #9# :DROP-TYPEMOD NIL)) (:SOURCE (:TYPE #12="decimal") :TARGET (:TYPE #12# :DROP-TYPEMOD NIL)) (:SOURCE (:TYPE #13="varchar") :TARGET (:TYPE #14="text")) (:SOURCE (:TYPE "tinytext") :TARGET (:TYPE #14#)) (:SOURCE (:TYPE #14#) :TARGET (:TYPE #14#)) (:SOURCE (:TYPE "mediumtext") :TARGET (:TYPE #14#)) (:SOURCE (:TYPE "longtext") :TARGET (:TYPE #14#)) (:SOURCE (:TYPE "char") :TARGET (:TYPE #13# :DROP-TYPEMOD NIL)) (:SOURCE (:TYPE "binary") :TARGET (:TYPE #15="bytea") :USING PGLOADER.TRANSFORMS::BYTE-VECTOR-TO-BYTEA) (:SOURCE (:TYPE "varbinary") :TARGET (:TYPE #15#) :USING PGLOADER.TRANSFORMS::BYTE-VECTOR-TO-BYTEA) (:SOURCE (:TYPE "tinyblob") :TARGET (:TYPE #15#) :USING PGLOADER.TRANSFORMS::BYTE-VECTOR-TO-BYTEA) (:SOURCE (:TYPE "blob") :TARGET (:TYPE #15#) :USING PGLOADER.TRANSFORMS::BYTE-VECTOR-TO-BYTEA) (:SOURCE (:TYPE "mediumblob") :TARGET (:TYPE #15#) :USING PGLOADER.TRANSFORMS::BYTE-VECTOR-TO-BYTEA) (:SOURCE (:TYPE "longblob") :TARGET (:TYPE #15#) :USING PGLOADER.TRANSFORMS::BYTE-VECTOR-TO-BYTEA) (:SOURCE (:TYPE #16="datetime" :DEFAULT #17="0000-00-00 00:00:00" :NOT-NULL T) :TARGET (:TYPE #18="timestamptz" :DROP-DEFAULT T :DROP-NOT-NULL T) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE #16# :DEFAULT #17#) :TARGET (:TYPE #18# :DROP-DEFAULT T) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE #19="timestamp" :DEFAULT #17# :NOT-NULL T) :TARGET (:TYPE #18# :DROP-DEFAULT T :DROP-NOT-NULL T) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE #19# :DEFAULT #17#) :TARGET (:TYPE #18# :DROP-DEFAULT T) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE #20="date" :DEFAULT "0000-00-00") :TARGET (:TYPE #20# :DROP-DEFAULT T) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE #20#) :TARGET (:TYPE #20#)) (:SOURCE (:TYPE "year") :TARGET (:TYPE #10# :DROP-TYPEMOD T)) (:SOURCE (:TYPE #16#) :TARGET (:TYPE #18#) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE #19#) :TARGET (:TYPE #18#) :USING PGLOADER.TRANSFORMS::ZERO-DATES-TO-NULL) (:SOURCE (:TYPE "enum") :TARGET (:TYPE #<FUNCTION PGLOADER.MYSQL::CAST-ENUM>)) (:SOURCE (:TYPE "set") :TARGET (:TYPE #<FUNCTION PGLOADER.MYSQL::CAST-SET>) :USING PGLOADER.TRANSFORMS::SET-TO-ENUM-ARRAY) (:SOURCE (:TYPE #21="point") :TARGET (:TYPE #21#) :USING PGLOADER.TRANSFORMS::CONVERT-MYSQL-POINT)))) (PGLOADER.SOURCES:*CAST-RULES* (QUOTE NIL)) (PGLOADER.PARAMS:*PG-SETTINGS* (QUOTE NIL)) (PGLOADER.PGSQL::*PGSQL-RESERVED-KEYWORDS* (PGLOADER.PGSQL:LIST-RESERVED-KEYWORDS #22=#<PGLOADER.PGSQL:PGSQL-CONNECTION pgsql://rails@UNIX:5432/renate_with_spree {1008EF25C3}>)) (PGLOADER.PARAMS:*COPY-BATCH-ROWS* (OR NIL PGLOADER.PARAMS:*COPY-BATCH-ROWS*)) (PGLOADER.PARAMS:*COPY-BATCH-SIZE* (OR NIL PGLOADER.PARAMS:*COPY-BATCH-SIZE*)) (PGLOADER.PARAMS:*CONCURRENT-BATCHES* (OR NIL PGLOADER.PARAMS:*CONCURRENT-BATCHES*)) (PGLOADER.PARAMS:*IDENTIFIER-CASE* (OR NIL PGLOADER.PARAMS:*IDENTIFIER-CASE*)) (PGLOADER.PARSER::SOURCE (MAKE-INSTANCE (QUOTE PGLOADER.MYSQL:COPY-MYSQL) :TARGET-DB #22# :SOURCE-DB #<PGLOADER.MYSQL:MYSQL-CONNECTION mysql://renate@localhost:3306/renate_with_spree {1008CF6D73}>))) NIL (PGLOADER.SOURCES:COPY-DATABASE PGLOADER.PARSER::SOURCE :INCLUDING (QUOTE NIL) :EXCLUDING (QUOTE NIL) :DECODING-AS (QUOTE NIL) :MATERIALIZE-VIEWS (QUOTE NIL) :STATE-BEFORE PGLOADER.PARSER::STATE-BEFORE :STATE-AFTER PGLOADER.PARSER::STATE-AFTER :STATE-INDEXES PGLOADER.PARSER::STATE-IDX :FOREIGN-KEYS NIL) NIL (PGLOADER.UTILS:REPORT-FULL-SUMMARY "Total import time" PGLOADER.PARAMS:*STATE* :BEFORE PGLOADER.PARSER::STATE-BEFORE :FINALLY PGLOADER.PARSER::STATE-AFTER :PARALLEL PGLOADER.PARSER::STATE-IDX))) :START-LOGGER NIL :SUMMARY NIL :LOG-FILENAME NIL :LOG-MIN-MESSAGES NIL :CLIENT-MIN-MESSAGES NIL)
15: ((FLET #:CLEANUP-FUN-267 :IN PGLOADER::MAIN)) [cleanup]
16: (PGLOADER::MAIN ("pgloader" "--with" "no foreign keys" "--debug" "mysql://renate:coosoyduj5go@localhost/renate_with_spree" "postgresql:///renate_with_spree"))
17: ((LAMBDA NIL :IN "/build/pgloader-o2qdpu/pgloader-3.2.2+dfsg/dumper-2SKVI5f7.lisp"))
18: ((FLET #:WITHOUT-INTERRUPTS-BODY-82 :IN SAVE-LISP-AND-DIE))
19: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))


debugger invoked on a QMYND:MYSQL-ERROR in thread
#<THREAD "main thread" RUNNING {1008B846C3}>:
  MySQL Error [1109]: "Unknown table 'referential_constraints' in information_schema"

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit application

(INVOKE-DEBUGGER #<QMYND:MYSQL-ERROR {100AA76083}>)
0] 2018-02-17T10:49:32.292000Z DEBUG MySQL: sending query: 
    SELECT tc.table_name, tc.constraint_name, k.referenced_table_name ft,

           group_concat(         k.column_name
                        order by k.ordinal_position) as cols,

           group_concat(         k.referenced_column_name
                        order by k.position_in_unique_constraint) as fcols,

           rc.update_rule, rc.delete_rule

      FROM information_schema.table_constraints tc

           JOIN information_schema.referential_constraints rc
             ON rc.constraint_schema = tc.table_schema
            AND rc.constraint_name = tc.constraint_name
            AND rc.table_name = tc.table_name

      LEFT JOIN information_schema.key_column_usage k
             ON k.table_schema = tc.table_schema
            AND k.table_name = tc.table_name
            AND k.constraint_name = tc.constraint_name

    WHERE     tc.table_schema = 'renate_with_spree'
          AND k.referenced_table_schema = 'renate_with_spree'
          AND tc.constraint_type = 'FOREIGN KEY'
         
         
         

 GROUP BY tc.table_name, tc.constraint_name, ft
2018-02-17T10:49:32.293000Z FATAL We have a situation here.

I connect to the database over an ssh tunnel in another session (ssh -L 3306:127.0.0.1:3306 user@host).

Querying @@Version on the mysql host returns me 5.0.95-log. I have no way to change this, because it runs on a shared host. :/ What I can do is to migrate to a vps, which is what I’m trying to do.

Я создаю базу данных, в которой проверяю входные данные с помощью триггеров. Я добавил их успешно, но при попытке ввести точные данные возникает ошибка.

Создание БД, таблиц и триггеров

CREATE DATABASE IF NOT EXISTS DBWorkers;

CREATE TABLE IF NOT EXISTS Ludzie(
PESEL char(11) NOT NULL,
imie varchar(30) NOT NULL,
nazwisko varchar(30) NOT NULL,
data_urodzenia date NOT NULL,
wzrost float NOT NULL,
waga float NOT NULL,
rozmiar_buta int NOT NULL,

PRIMARY KEY(PESEL));

DELIMITER $$
CREATE FUNCTION check_pesel(PESEL char(11)) RETURNS bool
BEGIN
IF(
    CHAR_LENGTH(NEW.PESEL) <> 11 AND
    CONVERT(PESEL, SIGNED INT) > 0 AND
    CONVERT(LEFT(PESEL,2), SIGNED INT) BETWEEN 0 AND 99 AND
    CONVERT(SUBSTRING(PESEL,3,2), SIGNED INT) BETWEEN 1 AND 12 AND
    CONVERT(SUBSTRING(PESEL,3,2), SIGNED INT) BETWEEN 1 AND     DAY(LAST_DAY(CONCAT('19',LEFT(PESEL,2),'-',SUBSTRING(PESEL,3,2),'-01')))
    )
    THEN
        RETURN TRUE;
    ELSE
        RETURN FALSE;
END IF;
END $$

CREATE TRIGGER `ludzie_data_check_before_insert` BEFORE INSERT ON `Ludzie`
FOR EACH ROW
BEGIN
IF NOT(
        check_pesel(NEW.PESEL) AND
        NEW.WZROST > 0.0 AND
        NEW.WAGA > 0.0 AND
        NEW.ROZMIAR_BUTA > 0
    )
THEN
    SIGNAL SQLSTATE '45000'
    SET MESSAGE_TEXT = 'check on Ludzie failed during insert';
END IF;
END $$
DELIMITER ;

Когда я пытаюсь ввести данные

INSERT INTO Ludzie VALUES ('7810396705', 'Anders', 'Kennedy','1958-08-20', 1.70, 88.6, 43)

Я получил

Error Code: 1109. Unknown table 'new' in field list

Я уже пробовал включать и выключать сервер mysql, проверял, делаю ли я это с правильной базой данных. Вроде все нормально, но это не так: /

2 ответа

Лучший ответ

Думаю, я нашел вашу проблему:

CHAR_LENGTH(NEW.PESEL) <> 11 AND
CONVERT(PESEL, SIGNED INT) > 0 AND

Это непоследовательное использование NEW.PESEL и PESEL, вы не должны использовать ключевое слово new в функции, которая ничего не добавляет в базу данных. В этом контексте ошибка распознала NEW как таблицу вместо ключевого слова.


2

user9048861user9048861
8 Дек 2017 в 02:07

Да, почитав немного, я тоже готов поспорить, что ключевое слово «NEW» не требуется в

CHAR_LENGTH (NEW.PESEL).

Ключевое слово NEW используется в командах обновления и вставки.


1

Eric F
8 Дек 2017 в 02:13

Понравилась статья? Поделить с друзьями:
  • Spring security error page
  • Sql error code 804 incorrect values within sqlda structure
  • Sql error 1067
  • Spring responseentity error
  • Sql error code 607