forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita6715af
committed
Add bit_count SQL function
This function for bit and bytea counts the set bits in the bit or bytestring. Internally, we use the existing popcount functionality.For the name, after some discussion, we settled on bit_count, whichalso exists with this meaning in MySQL, Java, and Python.Author: David Fetter <david@fetter.org>Discussion:https://www.postgresql.org/message-id/flat/20201230105535.GJ13234@fetter.org1 parent5aed6a1 commita6715af
File tree
9 files changed
+97
-1
lines changed- doc/src/sgml
- src
- backend/utils/adt
- include/catalog
- test/regress
- expected
- sql
9 files changed
+97
-1
lines changedLines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4010 | 4010 |
| |
4011 | 4011 |
| |
4012 | 4012 |
| |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
4013 | 4035 |
| |
4014 | 4036 |
| |
4015 | 4037 |
| |
| |||
4714 | 4736 |
| |
4715 | 4737 |
| |
4716 | 4738 |
| |
| 4739 | + | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
4717 | 4757 |
| |
4718 | 4758 |
| |
4719 | 4759 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
39 | 40 |
| |
40 | 41 |
| |
41 | 42 |
| |
| |||
1201 | 1202 |
| |
1202 | 1203 |
| |
1203 | 1204 |
| |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
1204 | 1218 |
| |
1205 | 1219 |
| |
1206 | 1220 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3440 | 3440 |
| |
3441 | 3441 |
| |
3442 | 3442 |
| |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
| 3448 | + | |
| 3449 | + | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
3443 | 3454 |
| |
3444 | 3455 |
| |
3445 | 3456 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1446 | 1446 |
| |
1447 | 1447 |
| |
1448 | 1448 |
| |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
1449 | 1452 |
| |
1450 | 1453 |
| |
1451 | 1454 |
| |
| |||
3876 | 3879 |
| |
3877 | 3880 |
| |
3878 | 3881 |
| |
| 3882 | + | |
| 3883 | + | |
| 3884 | + | |
3879 | 3885 |
| |
3880 | 3886 |
| |
3881 | 3887 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
710 | 710 |
| |
711 | 711 |
| |
712 | 712 |
| |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
713 | 726 |
| |
714 | 727 |
| |
715 | 728 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2227 | 2227 |
| |
2228 | 2228 |
| |
2229 | 2229 |
| |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + |
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
215 | 215 |
| |
216 | 216 |
| |
217 | 217 |
| |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
218 | 222 |
| |
219 | 223 |
| |
220 | 224 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
742 | 742 |
| |
743 | 743 |
| |
744 | 744 |
| |
| 745 | + | |
| 746 | + |
0 commit comments
Comments
(0)