This Question have no Text answers yet!

Retrieve inserted identity value from AWS Redshift via JDBC

Question!

While working with AWS Redshift is has come to my attention getting the last inserted id from a table with an identity column via JDBC driver cannot be accomplished with either of the following methods:

RETURNING key word

or

Statement.RETURN_GENERATED_KEYS 

as mentioned in the Stack Overflow entry:

How to get a value from the last inserted row?

The above methods are not available as Redshift (as of 10/17/2013) is built on PostgreSQL version 8.0.2. See the following documentation in the following link:

http://docs.aws.amazon.com/redshift/latest/dg/c_high_level_system_architecture.html

If you are intending to use Redshift as a RDBMS it is a worthwhile effort to read the following as well:

http://docs.aws.amazon.com/redshift/latest/dg/c_redshift-and-postgres-sql.html

Question:

What is the best strategy for retrieving the last inserted id on an auto-increment/serial/identity column in Redshift via PostgreSQL JDBC driver?

By : Darth Jon


Video about Retrieve inserted identity value from AWS Redshift via JDBC