Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Integer division by -1 on INT64_MIN raises a misclassified floating-point exception (22P01) instead of bigint out of range

Aperta Adatta ai principianti
#2,590 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@sean0407 ci sta già lavorando.

Dal 11/10/2026.

  • #2591 di @sean0407 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c, postgresql
Ambito
database

Direzione di ricerca

Parti dalla riproduzione: esegui la query Cypher RETURN (-9223372036854775807 - 1) / -1 dopo LOAD 'age' e osserva l'errore in virgola mobile 22P01. Trova la divisione intera nell'aritmetica agtype di AGE in C, dove avviene la divisione non controllata. Confrontala con int84div in int8.c di PostgreSQL, che in questo caso genera 22003 bigint out of range. È completato quando la query Cypher fallisce con un errore di bigint fuori intervallo e il comportamento esistente dell'aritmetica resta invariato per il resto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

AGE Version: Apache AGE extension 1.8.0 on PostgreSQL 18.6

Installation Method: Docker

API: Cypher

Steps to reproduce
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT * FROM ag_catalog.create_graph('gdbug');
SELECT * FROM cypher('gdbug', $$ RETURN (-9223372036854775807 - 1) / -1 $$) AS (r agtype);
Expected behavior

+9223372036854775808 is outside the signed 64-bit range, so this should fail with a range error. The host database already does exactly that for the identical expression, and AGE inherits that behaviour everywhere except in its own agtype arithmetic:

SELECT (-9223372036854775807 - 1) / -1;
-- ERROR:  22003: bigint out of range
-- LOCATION:  int84div, int8.c:986
Actual behavior

The Cypher path does not report a range error. The integer division is executed unchecked; the hardware raises #DE/SIGFPE, and PostgreSQL's signal handler converts it into a floating-point exception:

ERROR:  22P01: floating-point exception
DETAIL:  An invalid floating-point operation was signaled. This probably means
         an out-of-range result or an invalid operation, such as division by zero.
LOCATION:  FloatExceptionHandler, postgres.c:3077
Lingua principale
C
Stelle
4.9k
Fork
532
Merge medio
9g 18h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/age

Tutte le issue di apache/age

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.