Ticket Hash: | 7d4b236572e4302d8275920bbda5c2c4f811db69 | |||
Title: | Sql formatting used int32 instead of int64 | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Critical | Priority: | Immediate | |
Subsystem: | Resolution: | Fixed | ||
Last Modified: | 2018-07-29 20:00:45 | |||
Version Found In: | ||||
User Comments: | ||||
anonymous added on 2018-03-21 03:37:22:
(text/html)
Based on reported issue:<br> https://groups.google.com/forum/#!topic/spatialite-users/mDWg_LYiOH8 <hr> <pre> Using VirtualPG such as INSERT INTO pg_table(id) VALUES (110100014258002); where pg_table is the virtual table, which connects to a pg table with a <b>bigint</b> field, actually inserts a value -1472374958. </pre> (bigint = int8 = signed long = SQLITE_INTEGER)<br> This is possibly caused in 2 places in the 'virtualpg.c' code where:<br><br> <ul> sql = sqlite3_mprintf ("%<b>d</b>", sqlite3_value_<b>int</b> (argv[c2])); </ul><br> is being used.<br><br> <hr> Changing these 2 statements in<br><br> <b>vpgInsertRow</b> <ul> sql = sqlite3_mprintf ("%<b>ld</b>", sqlite3_value_<b>int64</b> (argv[c])); </ul><br> <b>vpgUpdateRow</b> <ul> sql = sqlite3_mprintf ("%<b>ld</b>", sqlite3_value_<b>int64</b> (argv[c2])); </ul><br> should resolve the problem.<br> Everything else seems to properly support int64<br><br> (vpgSetIntValue formats from string to sqlite3_int64 value).<br><br> <hr> The Postgres <b>CTID</b> seems to be 32 bit (<b>OID</b> is documented as such, but no meantion of the type for <b>CTID</b>)<br> <ul>'OIDs are 32-bit quantities'</ul> 5.4. System Columns <ul> https://www.postgresql.org/docs/8.2/static/ddl-system-columns.html </ul> and<br> 8.12. Object Identifier Types <ul> https://www.postgresql.org/docs/8.2/static/datatype-oid.html </ul> <hr> The only other use of <b>sqlite3_value_int</b> are for BOOLEAN values.<br><br> So everything else looks correct. <br> Mark sandro added on 2018-07-29 20:00:45: (text/x-fossil-plain) fixed by commit 184b370334 |