vapor-community / postgresql

Robust PostgreSQL interface for Swift
MIT License
131 stars 33 forks source link

README.md: LAST_INSERTED_ID() function does not exist in PostgreSQL #33

Closed azamsharp closed 7 years ago

azamsharp commented 7 years ago

Following does not work in Swift:

let connection = try postgreSQL.makeConnection() let result = try postgreSQL.execute("SELECT LAST_INSERTED_ID() as id", [], connection)

Here is the error:

"DatabaseError: invalidSQL(\"ERROR: function last_inserted_id() does not exist\nLINE 1: SELECT LAST_INSERTED_ID() as id;\n ^\nHINT: No function matches the given name and argument types. You might need to add explicit type casts.\n\")",

sroebert commented 7 years ago

Obviously this has to do with PostgreSQL not supporting what you are trying to do.

Just perform a google search and you end up with Stack Overflow

vzsg commented 7 years ago

You might be misunderstanding the issue. The README is copy-pasted from MySQL and contains incorrect code. We should clean it up sometime.

sroebert commented 7 years ago

Ok that makes sense