Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

369
Visualizações
Please give me example for differences of cidr and inet datatypes in PostgreSQL

From the DOC

The essential difference between inet and cidr data types is that inet accepts values with nonzero bits to the right of the netmask, whereas cidr does not.

Please give me example for differences of cidr and inet datatypes in PostgreSQL.

I do not understand that completely and want to see differences visually.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Seems I have found the answer

Say, if you have a /8 netmask, the cidr type requires that all the 24 rightmost bits are zero. inet does not have this requirement.

db=# select '255.0.0.0/8'::cidr;
255.0.0.0/8

db=# select '255.1.0.0/8'::cidr;
ERROR:  invalid cidr value: "255.1.0.0/8"
DETAIL:  Value has bits set to right of mask.

And inet allows this:

db=# select '255.1.0.0/8'::inet;
255.1.0.0/8
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda