postgresql报错:ERROR:field position must be greater than zero

Table of contents

1. Complete error report

2. Error details

Three, solve


1. Complete error report

ERROR:field position must be greater than zero(seg0 slice2 10.152.102.23:50000 pid=17673)

2. Error details

         It probably means that the position must be greater than 0

Three, solve

        After knowing the general meaning of the error report, you can view the sql statement of the error report. Is it possible to use certain functions to process fields, and then the functions are useless? This is the case for me.

        Wrong way:

--                         这块的0用的不对

select split_part(terminal_info,'#',0) ip
from xxx

        correct modification:

-- 报错的意思是split_part的最后一参数是必须要大于0,也就是从1开始的。

select split_part(terminal_info,'#',1) ip
from xxx

Guess you like

Origin blog.csdn.net/zkkkkkkkkkkkkk/article/details/130580950