Skip to content
Permalink
Browse files

Fixing pg build.

refs #2499
- Properly reference pg client
- Fix broken sql queries
  • Loading branch information...
halfdan committed Jul 31, 2014
1 parent a6c205a commit 640f4c29155c10b59eb97b76cd7a0021e2c9500f
Showing with 6 additions and 6 deletions.
  1. +3 −3 core/server/data/utils/clients/index.js
  2. +3 −3 core/server/data/utils/clients/{pgsql.js → pg.js}
@@ -1,10 +1,10 @@
var sqlite3 = require('./sqlite3'),
mysql = require('./mysql'),
pgsql = require('./pgsql');
pg = require('./pg');


module.exports = {
sqlite3: sqlite3,
mysql: mysql,
pgsql: pgsql
};
pg: pg
};
@@ -18,21 +18,21 @@ doRawFlattenAndPluck = function doRaw(query, name) {

getTables = function getTables() {
return doRawFlattenAndPluck(
'SELECT table_name FROM information_schema.tables WHERE table_schema = "public"', 'table_name'
'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\'', 'table_name'
);
};

getIndexes = function getIndexes(table) {
var selectIndexes = 'SELECT t.relname as table_name, i.relname as index_name, a.attname as column_name' +
' FROM pg_class t, pg_class i, pg_index ix, pg_attribute a' +
' WHERE t.oid = ix.indrelid and i.oid = ix.indexrelid and' +
' a.attrelid = t.oid and a.attnum = ANY(ix.indkey) and t.relname = "' + table + '"';
' a.attrelid = t.oid and a.attnum = ANY(ix.indkey) and t.relname = \'' + table + '\'';

return doRawFlattenAndPluck(selectIndexes, 'index_name');
};

getColumns = function getColumns(table) {
var selectIndexes = 'SELECT column_name FROM information_schema.columns WHERE table_name = "' + table + '"';
var selectIndexes = 'SELECT column_name FROM information_schema.columns WHERE table_name = \'' + table + '\'';

return doRawFlattenAndPluck(selectIndexes, 'column_name');
};

0 comments on commit 640f4c2

Please sign in to comment.
You can’t perform that action at this time.