id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 1480,OpenTable bug in ogrpgdatasource.cpp,sleary@…,warmerdam,"{{{ OpenTable does not check if the table exists before it adds it as a layer to the datasource. This then causes GetLayerByName to fail to ever return null when a layer does not exist as the layer is *ALWAYS* opened by the call to OpenTable. This can be demonstrated by executing the following pseudocode for (int i=0;i < 100; i++) { pgDatasource->GetLayerByName(RandomNameGenerator()); std::cout << ""LAYER COUNT "" << pgDataSource->GetLayerCount() << std::endl; } The prototype for RandomNameGenerator is: - char *RandomNameGenerator(); Each iteration increases the layer count even though it should not as the random names do not exist in the database. See Also GetLayerByName() which uses it as : - OpenTable( pszName, NULL, TRUE, FALSE ); if(GetLayerCount() == count+1) return GetLayer(count); return NULL; // (Unreachable code) }}}",defect,closed,highest,,OGR_SRS,unspecified,major,fixed,,