Architecture #2364
closed
Test for the XML fileformat in migration script for EventLog migration in DB
Added by François ARMAND over 12 years ago.
Updated over 9 years ago.
Description
We need to test for the lowest fileFormat version in the migration script, and set the result in the version table (see #2363)
The SQL query to test for fileFormat=1 is:
SELECT * FROM eventlog WHERE
xmlexists('/entry/*[@fileFormat=1]'PASSING BY REF data) OR
xmlexists('/entry/addPending'PASSING BY REF data)
LIMIT 1;
The SQL insert to do if the previous select return a result:
INSERT INTO migrationeventlog(detectiontime, detectedfileformat)
VALUES ('NOW', 1);
Of course, "NOW" should be date like "2012-02-13 02:19:09.89+01"
- Target version changed from 2.4.0~alpha6 to 2.4.0~alpha7
- Assignee changed from Jonathan CLARKE to Matthieu CERDA
- Subject changed from Test for the XML fileformat in migration script to Test for the XML fileformat in migration script for EventLog migration in DB
- Status changed from 2 to Discussion
- Assignee changed from Matthieu CERDA to François ARMAND
Hum, I can not use this testing statement, because the xmlexists function is only present on postgresql >= 9.1.
However, here is a summary of the supported OS and their psql version:
- SLES11: 8.3.9
- Debian 6: 8.4.11
- CentOS 6: 8.4.9
- Ubuntu 12.04: 9.1
- Ubuntu 11.10: 9.1
- Debian 5: 8.3.17
I need an alternate SQL query or a workaround, please :(
I didn't try to do it in one run, but the first part of the query, to count fileFormat 1 is :
select count(*) from (
select xpath('/entry/*[@fileFormat=1]',data) AS x
from eventlog) as Y
where array_upper(x, 1) > 0;
the second is :
select count(*) from (
select xpath('/entry/addPending',data) AS x
from eventlog) as Y
where array_upper(x, 1) > 0;
If any of them return a number greater than 0, then the update should be done
- Status changed from Discussion to Pending technical review
- % Done changed from 0 to 100
Applied in changeset commit:d7e8e7135ba571ed0f187ee6f7888c381ce398b4.
- Status changed from Pending technical review to 10
- Assignee changed from François ARMAND to Matthieu CERDA
Looks good to me! I'm glad this has been sorted.
- Tracker changed from User story to Architecture
- Status changed from 10 to Released
- Project changed from Rudder to 34
- Category deleted (
11)
- Project changed from 34 to Rudder
- Category set to Packaging
Also available in: Atom
PDF