[QGIS-Developer] Can't import GeoPackage generated by QGIS into PostGIS

Jonathan Moules jonathan-lists at lightpear.com
Mon Apr 1 13:50:30 PDT 2019


Hi,

This is in part because SQLite (what GeoPackage is built around) doesn't 
do character limits on text fields. You can declare them, but SQLite 
just ignores them.

That said, the GeoPackage format does allow for them:

"... The optional maxchar_count
defines the maximum number of characters in
the string. If not specified, the length is
unbounded. The count is provided for
informational purposes, and applications MAY
choose to truncate longer strings if encountered.
When present, it is best practice for applications
to adhere to the character count. Stored as
SQLite TEXT"

So I'd suggest that QGIS simply not declare text limits on string fields 
by default for GeoPackage, and only declare them when they're explicitly 
declared (i.e. in the original data format).

Cheers,

Jonathan

On 2019-03-31 15:30, Stefan Keller wrote:
> Hi,
>
> I could replicate this behavior (limiting string to 255) using QGIS 3
> by exporting a layer to a GeoPackage.
> My impression is, that GeoPackage data provider is replacing
> String/QString field types which have length 0, by a default length of
> 255 chars (which is obviously wrong).
>
> :Stefan
>
> Am So., 31. März 2019 um 13:47 Uhr schrieb Anita Graser <anitagraser at gmx.at>:
>>
>>
>> On Sun, Mar 31, 2019 at 11:42 AM Anita Graser <anitagraser at gmx.at> wrote:
>>> On Sat, Mar 30, 2019 at 10:11 PM Alessandro Pasotti <apasotti at gmail.com> wrote:
>>>> On Sat, Mar 30, 2019, 21:55 Anita Graser <anitagraser at gmx.at> wrote:
>>>>> - Option #2: QGIS shouldn't create GeoPackages that store long strings in field defined as text(255)
>>> I'll create a ticket for #2 then.
>>
>> Here it is: https://issues.qgis.org/issues/21714
>>
>> Regards,
>> Anita
>>
>>
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer




More information about the QGIS-Developer mailing list