Subscripts for nested collection does not work
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Comienza ejecutando el bloque DO de PostgreSQL del issue e inspecciona cómo funciona la subscriptación de colecciones con tt['1'] frente al caso de la variable proxy. Se considera terminado cuando la subscriptación anidada puede recuperar directamente el valor de la colección interna y el reproductor funciona correctamente sin una variable adicional.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
It is allowed to have a collection a as an element of other collection. But it is hard to get elements value directly
Steps to reproduce
Was tested on:
PostgreSQL 17.2 (Ubuntu 17.2-1.pgdg24.04+1) on aarch64-unknown-linux-gnu, compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit
DO
$$
DECLARE
t collection('bigint');
tt collection('collection');
BEGIN
t['1'] := 1;
t['2'] := 2;
tt['1'] := t;
RAISE NOTICE 'The current val of t[1] is %', t['1'];
RAISE NOTICE 'The datatype of t is %', pg_typeof(t);
RAISE NOTICE 'The datatype of tt is %', pg_typeof(tt);
RAISE NOTICE 'The datatype of t[1] is %', pg_typeof(t['1']);
RAISE NOTICE 'The datatype of tt[1] is %', pg_typeof(tt['1']);
RAISE NOTICE 'The current val of tt[1] is %', tt['1'];
RAISE NOTICE 'The current val of tt[1][1] is %', tt['1']['1'];
END
$$;
Expected outcome
Nested collection element value returned. Or provided a way to get it directly
Actual outcome
NOTICE: The current val of t[1] is 1
NOTICE: The datatype of t is collection
NOTICE: The datatype of tt is collection
NOTICE: The datatype of t[1] is bigint
NOTICE: The datatype of tt[1] is collection
NOTICE: The current val of tt[1] is {"value_type": "bigint", "entries": {"1": "1", "2": "2"}}
ERROR: collection allows only one subscript
CONTEXT: SQL expression "tt['1']['1']"
PL/pgSQL function inline_code_block line 20 at RAISE
Analysis
We see that tt is a correct collection having collection of integer as an element. If we use proxy variable, it is possible to return value:
DO
$$
DECLARE
t collection('bigint');
tt collection('collection');
x collection('bigint');
BEGIN
t['1'] := 1;
t['2'] := 2;
tt['1'] := t;
RAISE NOTICE 'The current val of t[1] is %', t['1'];
RAISE NOTICE 'The datatype of t is %', pg_typeof(t);
RAISE NOTICE 'The datatype of tt is %', pg_typeof(tt);
RAISE NOTICE 'The datatype of t[1] is %', pg_typeof(t['1']);
RAISE NOTICE 'The datatype of tt[1] is %', pg_typeof(tt['1']);
RAISE NOTICE 'The current val of tt[1] is %', tt['1'];
x := tt['1'];
RAISE NOTICE 'The current val of tt[1][1] is %', x['1'];
END
$$;
NOTICE: The current val of t[1] is 1
NOTICE: The datatype of t is collection
NOTICE: The datatype of tt is collection
NOTICE: The datatype of t[1] is bigint
NOTICE: The datatype of tt[1] is collection
NOTICE: The current val of tt[1] is {"value_type": "bigint", "entries": {"1": "1", "2": "2"}}
NOTICE: The current val of tt[1][1] is 1
It would be useful to have a way to get value without additional variables and copy.
E.g., PostgreSQL allows data structures like array of arrays and has ways to work with them directly
create domain ii as int[];
DO
$$
DECLARE
a ii;
b ii[];
begin
a[1] := 1;
RAISE NOTICE 'The current val of a[1] is %', a[1];
b[1] := a;
RAISE NOTICE 'The current val of b is %', b;
RAISE NOTICE 'The current val of b[1] is %', b[1];
RAISE NOTICE 'The current val of b[1][1] is %', (b[1])[1];
end;
$$;
NOTICE: The current val of a[1] is 1
NOTICE: The current val of b is {"{1}"}
NOTICE: The current val of b[1] is {1}
NOTICE: The current val of b[1][1] is 1
;
- Lenguaje dominante
- C
- Estrellas
- 24
- Forks
- 6
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/pgcollection
-
The LLVM object can build before collection_config.h is generatedPosiblemente ocupada @Vonng la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
aws/pgcollection#51 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
aws/pgcollection#50 ·
-
Nonempty icollection values cannot be read back from text or restored from a dumpPosiblemente ocupada @Vonng la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
aws/pgcollection#48 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
aws/pgcollection#32 ·
Todos los issues de aws/pgcollection
Issues similares
-
issue: bug report
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
BasedHardware/omi#26486 ·
Los mantenedores suelen responder en 1 día
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
yugabyte/yugabyte-db#39462 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
libreswan/libreswan#3185 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 3 días