Skip to content

Commit

Permalink
return uuid on insert
Browse files Browse the repository at this point in the history
  • Loading branch information
James Burke committed Jan 19, 2017
1 parent e49dd9b commit a73a097
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pydal/adapters/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def after_connection(self):

def lastrowid(self, table):
if self._last_insert:
return long(self.cursor.fetchone()[0])
pk = self.cursor.fetchone()[0]
try:
return long(pk)
except ValueError:
return str(pk)
sequence_name = table._sequence_name
self.execute("SELECT currval(%s);" % self.adapt(sequence_name))
return long(self.cursor.fetchone()[0])
Expand Down

0 comments on commit a73a097

Please sign in to comment.