You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In https://github.com/porsager/postgres which has a similar query syntax, there is a way to use dynamic identifiers for schema or table name. Need something similar here as well. Let me know how I can help.
consttableName='abc';awaitsql`SELECT * FROM ${sql(tableName)}`;
The text was updated successfully, but these errors were encountered:
Currently we don't have a mechanism for that, but certainly we should: I'll add it to my TODO list.
In the meantime, you should be able to work around this by using the sql function as an ordinary function, with (...), and providing an ordinary template string as the query. For example:
consttableName='abc';awaitsql(`SELECT * FROM ${tableName}`);
Obviously be careful with possible SQL injection attacks in this case.
If you also need to pass parameters when using the function like this then you should use $1, $2, etc. For example:
consttableName='abc';constlimit=10;awaitsql(`SELECT * FROM ${tableName} LIMIT $1`,[limit]);
In https://github.com/porsager/postgres which has a similar query syntax, there is a way to use dynamic identifiers for schema or table name. Need something similar here as well. Let me know how I can help.
The text was updated successfully, but these errors were encountered: