有没有办法查看MonetDB函数签名 [英] Is there a way to view MonetDB Function signatures

查看:167
本文介绍了有没有办法查看MonetDB函数签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到MonetDB函数签名的来源。
有些可以通过查询sys.functions表找到,但日期和时间函数缺少签名。
例如,如果您查看该表中的月功能,则表中列出了4个。

  | id |名称| func | mod | lang |键入| side_e | varres | vararg |> 
:::::uage::ffect:::>
+ ====== + ============ + ======= + ======= + ====== + == ==== + ======== + ======== + ======== +
| 901 |月|月| mtime | 0 | 1 | false | false | false |
| 910 |月|月| mtime | 0 | 1 | false | false | false |
| 916 |月|月| mtime | 0 | 1 | false | false | false |
| 922 |月|月| mtime | 0 | 1 | false | false | false |
| 930 | dayofmonth |一天| mtime | 0 | 1 | false | false | false |
+ ------ + ------------ + ------- + ------- + ------ + - ---- + -------- + -------- + --------

我猜测可以使用month,例如:
SELECTmonth(now());



我说得对 - 但我无法找到月份函数所带的参数列表,或者它们返回的结果。



这个问题不仅是关于month,我希望源代码找到sys.function表中所有函数的函数利用率。



其他RDBMS供应商对这些类型的函数进行了充实的说明 - 对于MonetDB,我找不到这样的东西,我只能假设我正在寻找错误的地方。

谢谢

解决方案

您可以在 sys.args 表中找到函数的参数/返回类型。您可以将此表与 sys.functions 表一起加入以获取特定函数的参数/返回类型。



例如,要获取月份函数的有效参数以及返回类型,可以使用以下查询。
$ b

SELECT functions.id,functions.name,args.name,args.type
FROM函数
INNER JOIN args
ON args.func_id = functions.id
WHERE functions.name ='month';


+ ------ + ------- + ------- + -------------- - +
| id |名称|名称|键入|
+ ====== + ======= + ======= + ================ +
| 1157 |月| res_0 | int |
| 1157 |月| arg_1 |日期|
| 1166 |月| res_0 | int |
| 1166 |月| arg_1 |时间戳|
| 1172 |月| res_0 | int |
| 1172 |月| arg_1 | timestamptz |
| 1178 |月| res_0 | int |
| 1178 |月| arg_1 | month_interval |
+ ------ + ------- + ------- + ---------------- +

我们可以看到有四个函数叫做month。它们都返回一个整数( res_0 ),并且采用日期 timestamp timestamptz month_interval 作为参数( arg_1 )。

I have tried to locate a source for MonetDB function signatures. Some can be found by querying the sys.functions table, but date and time functions are missing the signatures. for instance if you look at the "month" function in that table there are 4 listed in the table.

| id   | name       | func  | mod   | lang | type | side_e | varres | vararg |>
:      :            :       :       : uage :      : ffect  :        :        :>
+======+============+=======+=======+======+======+========+========+========    +
|  901 | month      | month | mtime |    0 |    1 | false  | false  | false  |
|  910 | month      | month | mtime |    0 |    1 | false  | false  | false  |
|  916 | month      | month | mtime |    0 |    1 | false  | false  | false  |
|  922 | month      | month | mtime |    0 |    1 | false  | false  | false  |
|  930 | dayofmonth | day   | mtime |    0 |    1 | false  | false  | false  |
+------+------------+-------+-------+------+------+--------+--------+--------

I took a guess that "month" could be used like: SELECT "month"(now());

And I was right - but I cannot find a list of the parameter the "month" functions take or what exactly they return.

This question is not only about "month" I would like a source to find the function utilization for all functions in the sys.function table.

Other RDBMS vendor have fleshed-out explanations for these types of functions - I find nothing like this for MonetDB, I can only assume I am looking in the wrong place. I read their documentation on the website and searched their website for this info, but I cannot find it.

Thank you

解决方案

You can find the parameters/return types of functions in the sys.args table. You can join this table together with the sys.functions table to get the parameters/return types of a specific function.

For example, to get the valid parameters of the month function as well as its return type the following query can be used.

SELECT functions.id, functions.name,args.name,args.type 
FROM functions 
INNER JOIN args 
ON args.func_id=functions.id 
WHERE functions.name='month';


+------+-------+-------+----------------+
| id   | name  | name  | type           |
+======+=======+=======+================+
| 1157 | month | res_0 | int            |
| 1157 | month | arg_1 | date           |
| 1166 | month | res_0 | int            |
| 1166 | month | arg_1 | timestamp      |
| 1172 | month | res_0 | int            |
| 1172 | month | arg_1 | timestamptz    |
| 1178 | month | res_0 | int            |
| 1178 | month | arg_1 | month_interval |
+------+-------+-------+----------------+

We can see that there are four functions called month. They all return an integer (res_0), and take either a date, timestamp, timestamptz or month_interval as parameter (arg_1).

这篇关于有没有办法查看MonetDB函数签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆