I'm having issues synchronizing my QField project into a PostGIS database. Nothing is synchronized, and I have the following error in the PostgreSQL logs:

2019-08-29 13:06:34 HST INSTRUCTION :  UPDATE "secosud"."elec_moa_supports" SET "_cree"='2001-10-06',"n_rec_trvx"='',"dphoto_1"='DCIM/20190829180916580.jpg',"dphoto_2"='DCIM/20190829181715420.jpg',"dphoto_3"='DCIM/20190829181757880.jpg',"dphoto_4"='DCIM/20190829181816755.jpg',"dtype_pot"='COMPOSITE',"dinc_pot"='OUI',"ddate"='',"dheure"='',"dutilisateur"='',"trvx_cnfrm"='OUI',"prof_pose"='CORRECT',"haut_pot"='9M',"com_haut"='CONFORME',"resis_pot"='150daN',"com_resis"='CONFORME',"depo_exis"='OUI',"com_deppot"='CONFORME',"mass_renf"='NON',"com_mass"='CONFORME',"dist_pot"='NON CONFORME',"com_dist"='PORTEE VERS TRNSFO 42M',"armem"='CONFORME',"com_armem"='',"nat_cable"='T70',"com_cable"='CONFORME',"depo_cable"='OUI',"com_depcab"='CONFORME',"haut_surpl"='CONFORME',"dphoto_5"='DCIM/20190829181833737.jpg',"com_typpot"='CONFORME',"com_inclin"='LEGEREMENT INCLINE VERS PLUS LONGUE PORTEE',"geom"=st_multi(st_geomfromwkb($1::bytea,3297)) WHERE "gid"=5197

 2019-08-29 13:30:16 HST ERREUR:  syntaxe en entrée invalide pour le type date : «  » au caractère 288

Note: this error disappears if I do step 3.

I have done the following, without success:

  1. closed project by opening new project in qfield restarting tablet
  2. manually added "ddate" and "dheure" fields (date, time respectively; updated using trigger upon db update)
  3. updating "ddate" and "dheure" manually on one point resulted in all added points to synchronize (new points not synchronized before this step), existing points with modified attributes not synchronized. I think the problem lies here, but why, and how to fix? I have been able to synchronize on occasionally even with these existing fields.
  4. set fid column to hidden

The date fields I have are all nullable. When I query the number of nulls via QGIS, I get the same number as via pgadmin. However, it seems like the NULL values are being interpreted as an empty string only when synchronizing. Is this an issue with the sqlite packaging? How to preserve NULL values instead of ''?

I believe my issue is related this thread, but I cannot figure out at which level the issue is coming from: QField 1.1.0, QField sync 3.2.1, QGIS 3.8, Postgresql 9.6, PostGIS?

  • 1
    Considering the error message and my knowledge of postgres, i think update a date type column (i.e ddate here) with a empty string doesn't work. ddate = "" is your problem, you need null instead (or a date in good format). – Maximilien jaffrès Sep 19 '19 at 8:40
  • @Maximilienjaffrès I wonder if it has to do with the way QGIS represents empty values or QField. I know how to change NULL value representations in project properties. Mine is current set to empty. Not sure how this translates via QField however. – user25976 Sep 19 '19 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.