按 1 排序会产生错误,而按列名排序没问题
order by 1 yield an error while order by column name is fine
select trigger_name,
event_manipulation,
event_object_schema,
event_object_table,
action_order,
action_condition,
action_orientation,
action_timing,
action_reference_old_table,
action_reference_new_table
from information_schema.triggers
where event_object_table in ('main_table')
order by 1 collate "C", 2;
产生错误:
ERROR: 42804: collations are not supported by type integer
LINE 13: order by 1 collate "C", 2;
但是:
order by trigger_name collate "C", 2;
可以。
collate "C",2
中的2
指的是什么?
main_table 只是一个简单的 table,它有一些触发器。
代码来源:https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/test/regress/expected/triggers.out;h=cd812336f2c70b1703d546f850a270f797829130;hb=7103ebb7aae8ab8076b7e85f335ceb8fe799097c
您在错误消息的第一行中找到了答案。 RDBMS 无法完成 1
的天数,而没有看到它与可以应用排序规则的文本列相关。
ERROR: 42804: collations are not supported by type integer
LINE 13: order by 1 collate "C", 2;
,2
只是按第 2 列排序的第二级。如果第 1 列中有相同的值,这些行将按第 2 列排序。
这与
相同
order by trigger_name collate "C",event_manipulation
select trigger_name,
event_manipulation,
event_object_schema,
event_object_table,
action_order,
action_condition,
action_orientation,
action_timing,
action_reference_old_table,
action_reference_new_table
from information_schema.triggers
where event_object_table in ('main_table')
order by 1 collate "C", 2;
产生错误:
ERROR: 42804: collations are not supported by type integer
LINE 13: order by 1 collate "C", 2;
但是:
order by trigger_name collate "C", 2;
可以。
collate "C",2
中的2
指的是什么?
main_table 只是一个简单的 table,它有一些触发器。
代码来源:https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/test/regress/expected/triggers.out;h=cd812336f2c70b1703d546f850a270f797829130;hb=7103ebb7aae8ab8076b7e85f335ceb8fe799097c
您在错误消息的第一行中找到了答案。 RDBMS 无法完成 1
的天数,而没有看到它与可以应用排序规则的文本列相关。
ERROR: 42804: collations are not supported by type integer
LINE 13: order by 1 collate "C", 2;
,2
只是按第 2 列排序的第二级。如果第 1 列中有相同的值,这些行将按第 2 列排序。
这与
order by trigger_name collate "C",event_manipulation