Skip to content

Question about PRs (I have a new function to contribute) #4

@hrbrmstr

Description

@hrbrmstr

Hey folks!

I make regular use of this extension and have made a function expand_cidr() that takes in an IP address (network or bare) and returns the expanded IPs from the CIDR in a list/array. Handles IPv4 & v6.

I'm curious if (a) y'all accept PRs and (b) if so, what should I do to ensure the least amount of work on your end?

A short example:

🦆>SELECT UNNEST(expand_cidr('192.168.1.0/32'::INET)) ip;
┌─────────────┐
│     ip      │
│    inet     │
├─────────────┤
│ 192.168.1.0 │
└─────────────┘
🦆>SELECT UNNEST(expand_cidr('192.168.1.0/30'::INET)) ip;
┌─────────────┐
│     ip      │
│    inet     │
├─────────────┤
│ 192.168.1.0 │
│ 192.168.1.1 │
│ 192.168.1.2 │
│ 192.168.1.3 │
└─────────────┘
🦆>FROM (SELECT UNNEST(expand_cidr('192.168.1.0/16'::INET)) ip) SELECT COUNT(ip);
┌───────────┐
│ count(ip) │
│   int64   │
├───────────┤
│     65536 │
└───────────┘
🦆>

Please ignore this PR: #3

This is the correct PR: #5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions