From 39de47554782695065f9265866a5e71244cc75fe Mon Sep 17 00:00:00 2001 From: jeancarlozapata Date: Tue, 10 Jun 2014 14:22:24 -0600 Subject: [PATCH] Fix inner query returning more than one result On MySQL, only the first table was being exposed in the database object after connecting to the database. The inner query returned more than one result, causing the external query to return only one table (the first one). The LIMIT 1 fixes this issue. --- lib/mysql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mysql.js b/lib/mysql.js index 28b980e..39e7322 100644 --- a/lib/mysql.js +++ b/lib/mysql.js @@ -20,7 +20,7 @@ var MySQL = function(credentials){ information_schema.key_column_usage \ where table_name = ist.table_name \ and constraint_schema = ist.table_schema \ - and constraint_name = 'PRIMARY' \ + and constraint_name = 'PRIMARY' LIMIT 1 \ ) as 'pk' \ from information_schema.tables ist \ where table_schema = '" + credentials.database + "'";