Backport fix for mis-detection of PostGIS table types (#9421)

Don't try to detect geometry type or srid, if it's already known
Backport of eaf5725f569fab62a67a51c0b0bddbb6a44797a2 by Jef