Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where should I define the schema name to execute query on specific schema for pg? #34

Open
shaishab opened this issue Sep 17, 2017 · 2 comments

Comments

@shaishab
Copy link

shaishab commented Sep 17, 2017

I would like to execute the query on specific schema in postgreSQL. so where can I define the schema name?
tried bellow code but not working

jsonSql.build({
         type: 'select',
          table: 'user',
          schema: 'schemaName',
          fields: fields,
          condition: condition
})

working by this way table: 'schemaName.tableName'

jsonSql.build({
         type: 'select',
          table: 'schemaName.tableName',
          fields: fields,
          condition: condition
})

Is this valid way or have other way ?

@artzhookov
Copy link
Contributor

artzhookov commented Sep 29, 2017

Your second example is valid, but not looks enow convenient.

What do you think about such format (not working, need to do):

jsonSql.build({
    type: 'select',
    table: {
        schema: 'schemaName',
        name: 'tableName'
    },
    fields: fields,
    condition: condition
});

@shaishab
Copy link
Author

shaishab commented Oct 1, 2017

I think that's good and schema may be optional that means if we don't define the schema then it should be work for public schema, so both format should work (my opinion)

jsonSql.build({
         type: 'select',
          table: 'tableName',
          fields: fields,
          condition: condition
})

and for

jsonSql.build({
    type: 'select',
    table: {
        schema: 'schemaName',
        name: 'tableName'
    },
    fields: fields,
    condition: condition
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants