12 Aug 2017

Redshift support for psql

Am sure you know that psql doesn't go out of it's way to support Postgres' forks natively. I obviously understand the reasoning, which allowed me to find a gap that I could fill here.

The existing features (in psql) that work with any Postgres fork (like Redshift) are entirely because it is a fork of Postgres. Since I use psql heavily at work, last week I decided to begin maintaining a branch of Postgres that better supports (Postgres forks, but initially) Redshift.

The 'redshift' branch of this Official Postgres Repository clone, is aimed at supporting Redshift in many ways:

  • Support Redshift related artifacts
    • Redshift specific SQL Commands / variations
    • Redshift Libraries
  • Support AWS specific artifacts

The idea is:

  • Maintain this branch for the long-term
    • At least as long as I have an accessible Redshift cluster
  • Down the line look at whether other Postgres forks (for e.g. RDS Postgres) need such special attention
    • Although nothing much stands out yet
      • Except some rare exceptions like this or this, which do need to go through an arduous long wait / process of refinement.
  • Change the default port to 5439 (or whatever the flavour supports)
    • ...with an evil grin ;)
  • Further, as of now, I don't expect to remove 'Unsupported Postgres features'
  • Additionally, as far as possible:
    • Keep submitting Postgres related patches back to Postgres master
    • Keep this branch up to date with Postgres master

Update (19th August 2017)

  • Currently this branch supports multiple Redshift specific commands such as
    • Returns non-SQL items like
      • ENCODINGs (essentially Compression)
      • REGIONs (for e.g. US-EAST-1 etc.)
  • With these commands fully supported (per specification) my current understanding is that it is (near) pointless to support non-functional keywords like LOCAL (in CREATE TABLE), which are probably just baggage from history.

    Let me know if you find anything that needs inclusion, or if I missed something.

    No comments: