final conclusion of the story: there was a bug.
when I said in a previous reply that NULL should be used in order
to mark an undefined argument I only checked the source code of
the GUI tool.
but there is a subtle difference between the GUI Wizard and
the SQL function:
- both call the same identical API
- but the SQL function checks the received arguments before
calling the API; and the bug was exactly here.
NULL values were incorrectly rejected for the "geom_column",
"pk_column" and "geometry_type" args.
the same issue affected ImportDBF() too ("pk_column").
the applied patch is already committed into the Fossil repo.
On Sat, 20 Aug 2022 06:42:27 -0700 (PDT), Antonio Valanzano wrote:
> It seems that NULL is not accepted (as it should be, if you do not
> want to use any existing column of the orginal shapefile as pk
>
> and you just want an INTEGER PRIMARY KEY AUTOINCREMENT column) and
> pk_uid is just a name that you specify for this scope.
>
> You could also use any name which doesn't already exists in the
> original dbf file
>
yes, that's correct: using the buggish version this is the best
workaround to circumvent the issue.
On Sat, 20 Aug 2022 06:59:13 -0700 (PDT), Antonio Valanzano wrote:
> For Sandro:
> suggestion for an improvement of the explanation of ImportSHP
> function
> within the SpatiaLite 5.0.1 SQL functions reference list
>
> NULL will be returned on invalid arguments.
>
> But in one of my attempts (the one with 'pk_uid' value) the result
> was
> NULL not becuase there were invalid arguments but because the
> internal
> table I was going to create already existed into the DB.
> It could be useful to integrate the explanation of the NULL result
> with also this situation.
>
I've corrected the documentation so to make clearer which arguments
could be legitimataly NUL and to add
NULL will be returned on invalid arguments or on any other error cause.
----------------------------------------------
Just one last final invitation addressed to Antonio.
when you think that you've discovered some bug, just say
"I suspect there is a bug because passing NULL as the
'pk_column' argument make the SQL function to fail"
your initial report was full of (almost useles) details
and concluded "What I am doing wrong ?"
this was completely misleading, and led me, Andrea and
Mark to give you irrelevant answers because our attention
was diverted from some other details that seemed suspicious
and that ended up just making a big mess.
please go straight to the point next time; if you think
there is a bug, say it clear and don't ask
"where am I wrong?"
bye Sandro