node.jsamazon-redshiftdbmigrate

What role permission needed for the user to get the server_version in Amazon redshift DB?


Currently i have a user called master in redshift which has SuperUser permission.

analytics=# \du
                      List of roles
  Role name  |          Attributes           | Member of 
-------------+-------------------------------+-----------
 master      | Superuser, Create DB          | 
 qac         |                               | 
 rdsdb       | Superuser, Create DB         +| 
             | Password valid until infinity | 
 report_user |                               | 

But when i execute show server_version;, i'm getting an error.

analytics=# show server_version;
ERROR:  must be superuser to examine "server_version"

Why i want show_version? I'm using db-migrate node_module in my node.js application. But when i try to run my migration scripts, i'm getting above error. Here is my verbose of db-migrate:

sangeeth@sangeeth-kumar ~/Desktop/analytics-api $ ./node_modules/.bin/db-migrate up --config cfg/database.json --verbose
[INFO] Detected and using the projects local version of db-migrate. '/home/sangeeth/Desktop/analytics-api/node_modules/db-migrate/index.js'
[INFO] Using dev settings: { driver: 'pg',
  database: 'analytics',
  user: 'master',
  password: '******',
  host: '*****',
  port: '****' }
[INFO] require: db-migrate-pg
[INFO] connecting
[INFO] connected
[SQL] show server_version_num
[SQL] show server_version
[ERROR] error: must be superuser to examine "server_version"
    at Connection.parseE (/home/sangeeth/Desktop/analytics-api/node_modules/pg/lib/connection.js:553:11)
    at Connection.parseMessage (/home/sangeeth/Desktop/analytics-api/node_modules/pg/lib/connection.js:378:19)
    at Socket.<anonymous> (/home/sangeeth/Desktop/analytics-api/node_modules/pg/lib/connection.js:119:22)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:607:20)

Note: I'm using postgres(pg) driver, since redshift is postgres compliance.

Anyone help me out?


Solution

  • SHOW server_version; is not supported. You would need to patch the library to use SELECT version(); instead.

    I will look into having this explicitly listed as being unsupported in this doc. https://docs.aws.amazon.com/redshift/latest/dg/c_unsupported-postgresql-functions.html