Open
Description
redshift migration is not working because of unsupported function server_version()
.
- Bug report
Current behavior
Since redshift is postgres compliance, i'm using db-migrate-pg
in my node.js application for redshift
.
When i ran migrate
script, i'm getting below error from redshift db.
Here is my verbose looks like:
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)
So we can see the error is thrown from redshift
.
I had asked this in SO.
Link to stackoverflow question
Got to know that show server_version();
is unsupported postgres function in redshift and they suggested to patch the library to work with select version();
instead.
analytics=# select version();
version
--------------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.2915
(1 row)
Expected behavior
Can you help me out, how to migrate my sql scripts in redshift?
Or
How to patch server_version
to use select version
?
Environment
db-migrate version: 0.11.1
db-migrate-pg: 0.4.0
redshift: 1.0.2915
PostgreSQL 8.0.2
Additional information:
- Node version: 8.11.1
- Platform: Linux
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/61112348-server_version-is-unsupported-in-redshift?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).