error when having sub statements with fields that do not exist

From: Jose Manuel <josemanuel(at)jmdnominas(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: error when having sub statements with fields that do not exist
Date: 2024-01-19 14:00:58
Message-ID: 21f3fb07-9073-4062-8376-a4b364002116@jmdnominas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I have found an error when having sub statements with fields that do not
exist.

The problem is that the worker table of the worker schema does not have
any field called id in its definition. If only the statement (SELECT id
FROM trabajador.trabajador WHERE idempresa=49) is executed, the error
occurs that the id column does not exist. But if this statement is in a
substatement (where id in), postgresql does not return an error, nor
does it return EOF because the where is wrong, but rather it returns all
the records of the personal.persons table (9609 records).

The correct sentence is: SELECT
id,nif,nombre,ape1,ape2,sexo,fechanac,nacion,locnac,provnac,nompadre,nommadre,ecivil,nhijos,nifconyuge,tipovia,calle,numero,piso,escalera,letra,codpos,locdom,provdom,tfnfijo,tfnmovil,tfnfax,email,web,entidad,sucursal,digito,cuenta,nafiliacionss,clavecorreo,ntarjeta

FROM personal.personas
WHERE nif in(SELECT idpersona FROM trabajador.trabajador WHERE
idempresa=49), which returns 36 records

Regards, and thank you very much

--


Jose Manuel Molina Dorador

Jefe de Sistemas. Dto. I+D, Desarrollo y Diseño Web

JMD Nóminas, S.L.

Horario de Trabajo: 09:00 - 15:00 | 17:00 - 19:00


953 65 19 07 <tel:953 65 19 07>

josemanuel(at)jmdnominas(dot)com <mailto:josemanuel(at)jmdnominas(dot)com>

www.jmdnominas.com <https://www.jmdnominas.com>

C/ Martinez de la Rosa, nº 6 - 1ºA C.P.: 23700 - Linares (Jaén)

Este mensaje ha sido enviado vía Internet. Las Comunicaciones vía
Internet no son seguras contra la interceptación o la modificación.
JMD NOMINAS por lo tanto no puede garantizar que este mensaje no ha sido
modificado en el tránsito y no acepta ninguna responsabilidad civil para la
información incluida aquí.

Este mensaje y cualquier archivo transmitido con el son confidenciales
(y pueden
estar legalmente privilegiados), con la intención de ser usados
únicamente por
el destinatario.

Si usted ha recibido este mensaje por equivocación por favor notifique
al remitente destruya sus copias del mensaje y cualquier archivo conectado.

En cumplimiento del Reglamento (UE) 2016/679 y de la Ley Orgánica 3/2018,
de 5 de diciembre, de Protección de Datos Personales y garantía de los
derechos
digitales. LOPDGDD, le informamos que sus datos personales serán
tratados por
JMD NÓMINAS Y PROTECCIÓN DE DATOS SL, como responsable del tratamiento,
con la
finalidad de gestionar su correspondiente consulta, solicitud o petición.
Los datos serán conservados mientras sean necesarios para gestionar su
correspondiente solicitud. No se prevén cesiones o comunicaciones de
datos salvo
las establecidas legalmente. Puede ejercer los derechos que reconoce la
normativa
en cualquier momento, dirigiéndose a la dirección de correo de
lopd(at)jmdnominas(dot)com,
así como interponer una reclamación ante la AEPD cuando sea necesario.

This message has been sent via the Internet. Internet communications
are not secure against interception or modification. JMD NOMINAS
therefore can
not guarantee that this message has not been
modified in transit and does not accept any legal responsibility for the
information included here.

This message and any files transmitted with it are confidential (and may be
legally privileged) and intended solely for the use of the addressee.
If you have received this message in error please notify the sender and
destroy your copies of the message and any attached files.

In compliance with Regulation (EU) 2016/679 and Organic Law 3/2018,
of December 5, Protection of Personal Data and guarantee of rights
digital. LOPDGDD, we inform you that your personal data will be processed by
JMD NÓMINAS Y PROTECCIÓN DE DATOS SL, as data controller, with the
purpose of managing your corresponding query, request or request.
The data will be kept as long as it is necessary to manage your
corresponding request. No transfers or data communications are foreseen
except
those legally established. You can exercise the rights recognized by the
regulations
at any time, by writing to the email address lopd(at)jmdnominas(dot)com,
as well as file a claim with the AEPD when necessary.

Attachment Content-Type Size
image/png 48.7 KB
image/png 41.7 KB
image/png 50.0 KB
Sentence.sql text/plain 790 bytes
sql_error.backup application/octet-stream 1.2 MB
image/png 16.0 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2024-01-19 14:28:22 Re: error when having sub statements with fields that do not exist
Previous Message Alexander Lakhin 2024-01-19 09:00:00 Re: BUG #18297: Error when adding a column to a parent table with complex inheritance