Sortables Captcha

SQL Error - Sortables Captcha

SQL Error

by Laserdan » Wed Sep 16, 2015 1:17 am

When configuring this extension I get an SQL on insert of the answers:

SQL ERROR [ mssqlnative ]

SQLSTATE: 23000 code: 544 message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert explicit value for identity column in table 'phpbb_sortables_answers' when IDENTITY_INSERT is set to OFF. [544]

SQL

INSERT INTO phpbb_sortables_answers (answer_id, question_id, answer_sort, answer_text) VALUES (9976, 1, 0, 'Patch')

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 855
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mssqlnative.php
LINE: 143
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mssqlnative->sql_query()

FILE: [ROOT]/ext/derky/sortablescaptcha/captcha/sortables.php
LINE: 896
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/ext/derky/sortablescaptcha/captcha/sortables.php
LINE: 843
CALL: derky\sortablescaptcha\captcha\sortables->acp_insert_answers()

FILE: [ROOT]/ext/derky/sortablescaptcha/captcha/sortables.php
LINE: 613
CALL: derky\sortablescaptcha\captcha\sortables->acp_update_question()

FILE: [ROOT]/ext/derky/sortablescaptcha/captcha/sortables.php
LINE: 577
CALL: derky\sortablescaptcha\captcha\sortables->acp_add_or_edit_question()

FILE: [ROOT]/includes/acp/acp_captcha.php
LINE: 50
CALL: derky\sortablescaptcha\captcha\sortables->acp_page()

FILE: [ROOT]/includes/functions_module.php
LINE: 674
CALL: acp_captcha->main()

FILE: [ROOT]/adm/index.php
LINE: 81
CALL: p_master->load_active()
Laserdan
Registered User
Posts: 1
Joined: Wed Jul 29, 2015 11:09 pm

Re: SQL Error

by Thomas Linder Puls » Tue Jul 06, 2021 9:19 am

I get the same problem (when Submiting Sortable Lists Questions) with version 2.0.2 and MS SQL:

SQL ERROR [ mssql_odbc ]

[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot insert explicit value for identity column in table 'phpbb_sortables_answers' when IDENTITY_INSERT is set to OFF. [23000]

SQL

INSERT INTO phpbb_sortables_answers (answer_id, question_id, answer_sort, answer_text) VALUES (82781, '2', 0, 'asd')
Thomas Linder Puls
Registered User
Posts: 2
Joined: Mon Jul 05, 2021 1:52 pm

Re: SQL Error

by Thomas Linder Puls » Tue Jul 06, 2021 9:35 am

Removing the auto_increment for answer_id in the table definition (migrations/v2_0_0.php)

Code: Select all

				$this->table_prefix . 'sortables_answers' => array(
					'COLUMNS' => array(
						'answer_id'		=> array('UINT', 0),
						'question_id'	=> array('UINT', 0),
						'answer_sort'	=> array('BOOL', 0),
						'answer_text'	=> array('STEXT_UNI', ''),
					),
Solves the problem (for new installations; not sure how to "migrate" that feature).
Thomas Linder Puls
Registered User
Posts: 2
Joined: Mon Jul 05, 2021 1:52 pm