简体   繁体   中英

Postgres %% in function

What does the "%%" in this statement mean?

SELECT nextval(seq_name) %% 1024 INTO seq_id;

And why does Postgres say, when I use it?

operator does not exist: bigint %% integer

Most probably, it's an artifact from translating dynamic SQL with format() , which requires to double % characters. Should be the modulo operator % if translated correctly, which also makes sense for a sharding solution or similar. Effectively, you get numbers cycling from 0 to 1023.

I suspect it's the same as we already dealt with here:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM