Semanticmediawiki: Invalid input syntax for bytea - SMW::writePropertyTableRowUpdates-insert-smw_di_blob

Created on 29 Sep 2016  路  2Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 2.4.1
  • MW version: 1.27.1
  • DB (MySQL etc.): Postgres 9.4

    Issue

When running

sudo -u wwwrun php /srv/www/htdocs-wiki-doku/extensions/SemanticMediaWiki/maintenance/rebuildData.php -d 100

I get the following error:

Database error occured.
Query: INSERT INTO "smw_di_blob" (s_id,p_id,o_blob,o_hash) VALUES ('1764','933','C:\Program Files (x86)\AnotherFolderHere\AndAnotherFolderHereToo\AndTheNameOfTheFileHere.exe','C:\Program Files (x86)\AnotherFolderHerea30462340362b7e3c3073054bd572471')
Funktion: SMW::writePropertyTableRowUpdates-insert-smw_di_blob
Fehler: 22P02 ERROR:  invalid input syntax for typ bytea
LINE 1: ...b" (s_id,p_id,o_blob,o_hash) VALUES ('1764','933','C:\Progra...

Steps to reproduce the observation:

I have a Semantic Forms form where I can save a file-path. Typ of the property is "text".
Resulting pages look like this for example:

{{Windows Service
|Name=JustATest
|Path=C:\Program Files (x86)\AnotherFolderHere\AndAnotherFolderHereToo\AndTheNameOfTheFileHere.exe
|StartupType=Automatic
|LogonUser=hwe,
|Hostname=ABCDEF01, ABCDEF02,
|Description=It does something
}}

It seems it has something to do with the length of the "path" combined with backslashes, but I'm not quite sure. Shorter "paths" do work. Or short paths with backslashes.

bug rdbms-postgres

Most helpful comment

Fehler: 22P02 ERROR: invalid input syntax for typ bytea

This error relates to [0] caused by how postgres is handling escaped \ character for table columns that use the bytea type. SMW uses bytea on o_blob fields that contain text strings longer than MAX_HASH_LENGTH [1] chars.

[0] https://stackoverflow.com/questions/28631807/postgresql-error-invalid-input-syntax-for-type-bytea
[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/storage/SQLStore/SMW_DIHandler_Blob.php#L34

All 2 comments

Fehler: 22P02 ERROR: invalid input syntax for typ bytea

This error relates to [0] caused by how postgres is handling escaped \ character for table columns that use the bytea type. SMW uses bytea on o_blob fields that contain text strings longer than MAX_HASH_LENGTH [1] chars.

[0] https://stackoverflow.com/questions/28631807/postgresql-error-invalid-input-syntax-for-type-bytea
[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/storage/SQLStore/SMW_DIHandler_Blob.php#L34

Expected to be solved by #1885 (added an extra integration test with > MAX_HASH_LENGTH)

Was this page helpful?
0 / 5 - 0 ratings