Hi Peter,
there was a Deadly Sin affecting the code; more precisely
there was an offence against the Second Commandment.
Please see: The Ten Commandments for C Programmers
(Annotated Edition) [1]
------------
2. Thou shalt not follow the NULL pointer, for chaos
and madness await thee at its end.
Clearly the holy scriptures were mis-transcribed here,
as the words should have been ``null pointer'', to
minimize confusion between the concept of null
pointers and the macro NULL (of which more anon).
Otherwise, the meaning is plain.
A null pointer points to regions filled with dragons,
demons, core dumps, and numberless other foul creatures,
all of which delight in frolicing in thy program if
thou disturb their sleep.
A null pointer doth not point to a 0 of any type,
despite some blasphemous old code which impiously
assumes this.
------------
Post Mortem Report
==================
The VirtualPG module starts by attempting to
establish a connection to PostgreSQL.
If the connection is successfully established
then a SQL query on behalf of the Postgres
metadata tables is executed so to extract
the fully qualified list of all Columns
belonging to the required Table.
If such Table doesn't exists (wrong/misspelled
Schema-name and/or Table-name) the above query
will obviously return an empty (0 rows) resultset.
And even more important, the C data structure
containing the Columns list will remain
uninitialized (pointing to NULL).
The old implementation lacked any elementary
precaution intended to handle in a proper
way the failing query, and a program crash
was the obvious consequence.
Applied patch: now the failing query nicely
reports an error and exit gracefully.
bye Sandro