Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: support inet data types #6981

Closed
abh opened this issue Jun 1, 2016 · 10 comments
Closed

sql: support inet data types #6981

abh opened this issue Jun 1, 2016 · 10 comments
Assignees
Labels
A-sql-semantics C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community
Milestone

Comments

@abh
Copy link

abh commented Jun 1, 2016

The inet and cidr data types in postgresql are very powerful for applications that deal with IP addresses; in particular IPv6 ones.

https://www.postgresql.org/docs/current/static/datatype-net-types.html
https://www.postgresql.org/docs/current/static/functions-net.html

@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-semantics labels Jun 4, 2016
@knz knz mentioned this issue Aug 4, 2016
3 tasks
@petermattis petermattis added this to the Later milestone Feb 22, 2017
@jordanlewis
Copy link
Member

This is required by a popular app that runs on Postgres - Mastodon.

@dianasaur323 dianasaur323 added O-community Originated from the community and removed community-questions labels Aug 8, 2017
@dianasaur323
Copy link
Contributor

adding @nstewart to the chain

@aaomidi
Copy link

aaomidi commented Aug 22, 2017

This is absolutely required for any modern day application. It being open for more than a year with barely any updates is worrisome.

@nstewart
Copy link
Contributor

This is on our radar and is scheduled to be part of the 1.2 release (mid-2018). We expect it to be in an alpha version of CockroachDB much earlier than that.

@nstewart nstewart modified the milestones: 1.2, Later Aug 28, 2017
lgo added a commit to lgo/cockroach that referenced this issue Sep 19, 2017
Adds further support for cockroachdb#6981.

This adds several built-in functions for the INET column. See
https://www.postgresql.org/docs/9.6/static/functions-net.html for
reference. The added built-ins are:
- abbrev(inet) text
- broadcast(inet) text
- family(inet) int (this is "ip_family" due to a YACC grammar conflict)
- host(inet) text
- hostmask(inet) inet
- masklen(inet) int
- netmask(inet) inet
- set_masklen(inet, int) inet
- text(inet) text
- inet_same_family(inet, inet) boolean

This does not include the built-ins
- network(inet) cidr
- inet_merge(inet, inet) cidr
@vivekmenezes vivekmenezes changed the title sql: support inet and cidr data types sql: support inet data types Sep 19, 2017
@vivekmenezes
Copy link
Contributor

We are not adding CIDR support now until we find a need for it. Thanks!

@aaomidi
Copy link

aaomidi commented Sep 21, 2017

What defines a need?

lgo added a commit to lgo/cockroach that referenced this issue Sep 21, 2017
Adds further support for cockroachdb#6981.

This adds several built-in functions for the INET column. See
https://www.postgresql.org/docs/9.6/static/functions-net.html for
reference. The added built-ins are:
- abbrev(inet) text
- broadcast(inet) text
- family(inet) int (this is "ip_family" due to a YACC grammar conflict)
- host(inet) text
- hostmask(inet) inet
- masklen(inet) int
- netmask(inet) inet
- set_masklen(inet, int) inet
- text(inet) text
- inet_same_family(inet, inet) boolean

This does not include the built-ins
- network(inet) cidr
- inet_merge(inet, inet) cidr
lgo added a commit to lgo/cockroach that referenced this issue Sep 25, 2017
Adds further support for cockroachdb#6981.

This adds several built-in functions for the INET column. See
https://www.postgresql.org/docs/9.6/static/functions-net.html for
reference. The added built-ins are:
- abbrev(inet) text
- broadcast(inet) text
- family(inet) int
- host(inet) text
- hostmask(inet) inet
- masklen(inet) int
- netmask(inet) inet
- set_masklen(inet, int) inet
- text(inet) text
- inet_same_family(inet, inet) boolean

This does not include the built-ins
- network(inet) cidr
- inet_merge(inet, inet) cidr

This also moves 'FAMILY' in the SQL grammar from reserved_keyword to
type_func_name_keyword.
lgo added a commit to lgo/cockroach that referenced this issue Sep 25, 2017
Adds further support for cockroachdb#6981.

This adds several built-in functions for the INET column. See
https://www.postgresql.org/docs/9.6/static/functions-net.html for
reference. The added built-ins are:
- abbrev(inet) text
- broadcast(inet) text
- family(inet) int
- host(inet) text
- hostmask(inet) inet
- masklen(inet) int
- netmask(inet) inet
- set_masklen(inet, int) inet
- text(inet) text
- inet_same_family(inet, inet) boolean

This does not include the built-ins
- network(inet) cidr
- inet_merge(inet, inet) cidr

This also moves 'FAMILY' in the SQL grammar from reserved_keyword to
type_func_name_keyword.
lgo added a commit to lgo/cockroach that referenced this issue Sep 25, 2017
Adds further support for cockroachdb#6981.

This adds several built-in functions for the INET column. See
https://www.postgresql.org/docs/9.6/static/functions-net.html for
reference. The added built-ins are:
- abbrev(inet) text
- broadcast(inet) text
- family(inet) int
- host(inet) text
- hostmask(inet) inet
- masklen(inet) int
- netmask(inet) inet
- set_masklen(inet, int) inet
- text(inet) text
- inet_same_family(inet, inet) boolean

This does not include the built-ins
- network(inet) cidr
- inet_merge(inet, inet) cidr

This also moves 'FAMILY' in the SQL grammar from reserved_keyword to
type_func_name_keyword.
@lgo
Copy link
Contributor

lgo commented Sep 27, 2017

In the case of CIDR, if people bring up major projects that make use of that column specifically then I'd be more than happy to spend some time adding it. To my knowledge, CIDR is strictly less useful than INET as it seems to be a subset of INET. I'll be closing this as I've added the INET type and it's built-ins, but I created an issue to track the CIDR type, #18846.

I also didn't add many of the operators postgres supports for INET yet so there's another issue to track that, #18847. I didn't find the operators were in common use so I just didn't get around to it yet.

@lgo lgo closed this as completed Sep 27, 2017
@KempWatson
Copy link

NetBox? Any modern cloud app (like, the apps that would want CRDB), would have good use for all three network datatypes.

@knz
Copy link
Contributor

knz commented Jun 23, 2018

@KempWatson you're lucky I was running a random script on the github database to notice your comment. We don't see comments on closed issues otherwise. Please file a new issue if you find this important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-semantics C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community
Projects
None yet
Development

No branches or pull requests