GithubHelp home page GithubHelp logo

Comments (4)

1602 avatar 1602 commented on July 18, 2024

I think this diff will implement required feature:

diff --git a/lib/adapters/postgres.js b/lib/adapters/postgres.js
index e3f848c..aff215c 100644
--- a/lib/adapters/postgres.js
+++ b/lib/adapters/postgres.js
@@ -196,7 +196,7 @@ PG.prototype.fromDatabase = function (model, data) {
 };

 PG.prototype.escapeName = function (name) {
-    return '"' + name + '"';
+    return '"' + name.replace(/\./g, '"."') + '"';
 };

When defining model, just pass 'tableName' param, or use setTableName('database.table') in railwayjs

from jugglingdb.

fsateler avatar fsateler commented on July 18, 2024

The only problem I see is if a table really had a . In its name. I don't,
but maye someone will have one at some point. I'm not sure if that casee
warrants looking for a more elaborate solution

On 12 Apr 2012 20:26, "Anatoliy Chakkaev" <
[email protected]>
wrote:

I think this diff will implement required feature:

diff --git a/lib/adapters/postgres.js b/lib/adapters/postgres.js
index e3f848c..aff215c 100644
--- a/lib/adapters/postgres.js
+++ b/lib/adapters/postgres.js
@@ -196,7 +196,7 @@ PG.prototype.fromDatabase = function (model, data) {
 };

 PG.prototype.escapeName = function (name) {
-    return '"' + name + '"';
+    return '"' + name.replace(/\./g, '"."') + '"';
 };

When defining model, just pass 'tableName' param, or use
setTableName('database.table') in railwayjs


Reply to this email directly or view it on GitHub:
#68 (comment)

from jugglingdb.

1602 avatar 1602 commented on July 18, 2024

Yep, this may cause issues, but we don't break existing code, since
setTableName is not documented feature yet.
And one more thing need to review - migration on postgres after this change.

On Fri, Apr 13, 2012 at 4:39 AM, fsateler <
[email protected]

wrote:

The only problem I see is if a table really had a . In its name. I don't,
but maye someone will have one at some point. I'm not sure if that casee
warrants looking for a more elaborate solution

On 12 Apr 2012 20:26, "Anatoliy Chakkaev" <
[email protected]>
wrote:

I think this diff will implement required feature:

diff --git a/lib/adapters/postgres.js b/lib/adapters/postgres.js
index e3f848c..aff215c 100644
--- a/lib/adapters/postgres.js
+++ b/lib/adapters/postgres.js
@@ -196,7 +196,7 @@ PG.prototype.fromDatabase = function (model, data) {
 };

 PG.prototype.escapeName = function (name) {
-    return '"' + name + '"';
+    return '"' + name.replace(/\./g, '"."') + '"';
 };

When defining model, just pass 'tableName' param, or use
setTableName('database.table') in railwayjs


Reply to this email directly or view it on GitHub:
#68 (comment)


Reply to this email directly or view it on GitHub:
#68 (comment)

Thanks,
Anatoliy Chakkaev

from jugglingdb.

1602 avatar 1602 commented on July 18, 2024

Everything is working fine.

from jugglingdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.