-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Course backups created on sites running MySQL for their database sites cant be restored to sites running Postgres due to an incompatibility with the data format for the deleted field. In MySQL the deleted field is of the type varchar (1)
mysql> describe mdl_questionnaire_question
-> ;
+-----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+----------------+
| id | bigint | NO | PRI | NULL | auto_increment |
| surveyid | bigint | NO | MUL | 0 | |
| name | varchar(30) | YES | | NULL | |
| type_id | bigint | NO | | 0 | |
| result_id | bigint | YES | | NULL | |
| length | bigint | NO | | 0 | |
| precise | bigint | NO | | 0 | |
| position | bigint | NO | | 0 | |
| content | longtext | NO | | NULL | |
| required | varchar(1) | NO | | n | |
| deleted | varchar(1) | NO | | n | |
| extradata | longtext | YES | | NULL | |
+-----------+-------------+------+-----+---------+----------------+
12 rows in set (0.01 sec)
and the default value is n.
However with Postgres the field type is bigint.
cve2sb=> \d mdl_questionnaire_question
Table "public.mdl_questionnaire_question"
Column | Type | Collation | Nullable | Default
-----------+-----------------------+-----------+----------+--------------------------------------------------------
id | bigint | | not null | nextval('mdl_questionnaire_question_id_seq'::regclass)
surveyid | bigint | | not null | 0
name | character varying(30) | | |
type_id | bigint | | not null | 0
result_id | bigint | | |
length | bigint | | not null | 0
precise | bigint | | not null | 0
position | bigint | | not null | 0
content | text | | not null |
required | character varying(1) | | not null | 'n'::character varying
deleted | bigint | | |
extradata | text | | |
Indexes:
"mdl_quesques_id_pk" PRIMARY KEY, btree (id)
When restoring a course that has been created on the MySQL site to the Postgres site the restore bombs out with the following error....
Debug info: ERROR: invalid input syntax for type bigint: "y"
CONTEXT: unnamed portal parameter $10 = '...'
INSERT INTO mdl_questionnaire_question (surveyid,name,type_id,result_id,length,precise,position,content,required,deleted,extradata) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11) RETURNING id
[array (
'surveyid' => 8,
'name' => 'Reflection Vid 1 Q1',
'type_id' => '3',
'result_id' => NULL,
'length' => '5',
'precise' => '0',
'position' => '-2',
'content' => '
Test question text
<iframe src="https://player.vimeo.com/video/516529984" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen="" width="640" height="360" frameborder="0"></iframe>
Question
'required' => 'n',
'deleted' => 'y',
'extradata' => NULL,
)]
Error code: dmlwriteexception