What if PostgreSql introduce a new function with name "cypher" then how to distingush between cypher and sql query with cypher function

huangapple go评论46阅读模式
英文:

What if PostgreSql introduce a new function with name "cypher" then how to distingush between cypher and sql query with cypher function

问题

目前,Apache-age 查询的结构如下:

SELECT * FROM cypher(<graph_name>, <cypher_query>)

我不确定在加载age扩展之后,PostgreSQL如何能够区分常规的SQL查询和Cypher查询。

目前,解析器可以通过查看选择语句的from子句中的cypher函数来区分Cypher查询和普通SQL查询。[我们正在使用这种方法来区分Cypher和普通查询]

但我担心如果PostgreSQL引入一个名为"cypher"的新函数,用于某些功能,就像我们在下面的示例中在from子句中使用generate_series一样,那么就会发生冲突。在开发中,我们该如何解决这个问题?

英文:

Currently, the structure of Apache-age query is:

SELECT * FROM cypher(<graph_name>, <cypher_query>)

I am not sure how PostgreSQL is able to distinguish between regular sql queries and Cypher queries after loading age extension.

For now parsers can differentiate between cypher query and normal SQL queries by looking at cypher function in the from clause of select statement. [We are using this approach to distinguish between cypher and normal queries]

But I was concerned that if PostgreSql introduce a new function with the name "cypher" for some functionality, let's say that cypher function can be used in from-clause like we use generate_series in from-clause in the following example.

SELECT * FROM generate_series(1, 10) AS number;

Then there will be conflict in between. How can we resolve that in development?

答案1

得分: 2

如果PostgreSQL引入了一个新的系统函数,该函数将位于系统模式pg_catalog中。您可以通过在函数名称前加上模式来消除这样一个函数与您的函数之间的歧义,例如

SELECT myschema.cypher(...);

英文:

If PostgreSQL introduces a new system function, that function will be in the system schema pg_catalog. You can disambiguate between such a function and your function by qualifying the function name with the schema, for example

SELECT myschema.cypher(...);

huangapple
  • 本文由 发表于 2023年2月16日 03:50:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75464803.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定