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
Hi,
Here's an example query I'm trying to make that involves a SQL function, here I'm using the Apache AGE extension but I'd assume all functions should work similarly.
exportconstcypher=async(graph: string,query: string,type: string[])=>{consta='users';constb='RETURN 1';constq=awaitsql` SELECT * FROM cypher('${a}', $$ ${b} $$) AS (n agtype) `;
...
};
The query above doesn't work with error:
PostgresError: graph "$1" does not exist
Further debugging shows, when code is modified to:
exportconstcypher=async(graph: string,query: string,type: string[])=>{consta='users';constb='RETURN 1';constq=awaitsql` SELECT * FROM cypher('users', $$ ${b} $$) AS (n agtype) `;
...
};
I get
PostgresError: unexpected character at or near "$"
And lastly, if the entire literal is entered
exportconstcypher=async(graph: string,query: string,type: string[])=>{consta='users';constb='RETURN 1';constq=awaitsql` SELECT * FROM cypher('users', $$ RETURN 1 $$) AS (n agtype) `;
...
};
the query works.
How should I interact with functions? Thanks.
I know that sql.unsafe() works, but trying my best to avoid.
The text was updated successfully, but these errors were encountered:
Hi,
Here's an example query I'm trying to make that involves a SQL function, here I'm using the Apache AGE extension but I'd assume all functions should work similarly.
The query above doesn't work with error:
Further debugging shows, when code is modified to:
I get
And lastly, if the entire literal is entered
the query works.
How should I interact with functions? Thanks.
I know that
sql.unsafe()
works, but trying my best to avoid.The text was updated successfully, but these errors were encountered: