summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 3d283fa188..9fe78dad2a 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -203,11 +203,10 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
char *id = NULL;
- if (H->pgoid == InvalidOid) {
- return NULL;
- }
-
if (name == NULL) {
+ if (H->pgoid == InvalidOid) {
+ return NULL;
+ }
*len = spprintf(&id, 0, "%ld", (long) H->pgoid);
} else {
PGresult *res;