Hi Sarthak,

The first version is not working (do you test it?): https://github.com/sarthak-0415/gdal/commit/36344cc26f23202cb289390322c1d295697136bd#diff-31df0e62d00ca09f9f11ad2f29e94b54R2541 Here you try to get array value with index -1. You need to set ppszDbname = NULL no DB name present in input parameters.

The second variant is not working too:
>>> ds = gdal.Open('PG:')
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

In both cases there is a problem here: https://github.com/sarthak-0415/gdal/blob/6264d3fc52242fdce858547cc3a0312b04fd638b/gdal/frmts/postgisraster/postgisrasterdataset.cpp#L2743

Also look there ppszDbname is using, as before modifications the code expect that ppszDbname cannot be NULL.

Best regards,
    Dmitry

15.03.2016 13:13, sarthak agarwal пишет:

Hey Dmitry ,
As discussed on the IRC yesterday,
I made the changes in the code.

I build two versions of the code

1.

    The changes suggested by you (to use the old trunk code and remove
    the additional checks) link
    
<https://github.com/sarthak-0415/gdal/commit/36344cc26f23202cb289390322c1d295697136bd>
    travis <https://travis-ci.org/sarthak-0415/gdal/builds/116070409> .
    a. in this version the Dbname is left empty if not provided by the
    user.

2.

    The version in which we
    a. if the Dbname is provided by the user then ppzDbname=Dbname.
    b. else use the psql env var PGDATABASE
    c. else use the Username as the database name.
    d. if nothing is available then pass empty string.
    e link
    
<https://github.com/sarthak-0415/gdal/commit/6264d3fc52242fdce858547cc3a0312b04fd638b>
    travis <https://travis-ci.org/sarthak-0415/gdal/builds/116055868>

I think both version should work

Regards,
Sarthak

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to