BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table - Mailing list pgsql-bugs

From smatiz@hotmail.com
Subject BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table
Date
Msg-id E1TqpOk-0007By-DS@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table
Re: BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7784
Logged by:          Santiago Matiz Vasquez
Email address:      smatiz@hotmail.com
PostgreSQL version: 9.2.2
Operating system:   MAC LION 10.7.4
Description:        =



CREATE OR REPLACE FUNCTION financiero.marchar(pidproducto int,pcant
int,pnrocuenta int,pcedula character varying(20)) RETURNS character
varying(100) AS $$
DECLARE
 valores inventarios.productos%ROWTYPE;
 mesa general.mesa%ROWTYPE;
 =

 nromesa int;
 valorTOTAL real;
 valorIVA integer;

 salida character varying(100);
BEGIN

/* =

Busca dentro de la tabla de numero de cuenta la asociacion con la mesa
   si no la encuentra pone 0
*/
SELECT * INTO mesa FROM general.mesa WHERE nrocuenta =3D pnrocuenta;
IF (mesa.nrocuenta IS NULL) THEN
  nromesa :=3D 0;
ELSE
  nromesa :=3D mesa.nrocuenta;
END IF;

/* consulta el valor del producto */
 SELECT INTO valores * FROM inventarios.productos  WHERE
idproducto=3Dpidproducto;

RAISE NOTICE 'valores.iva (%)', =EF=BB=BFvalores.iva;

 valorTOTAL :=3D valores.valor * valores.iva * pcant;
 =



salida :=3D cast(valores.idproducto  as character varying(5))|| '|' ||
valores.nombre || '|' || CAST(valores.valor AS character varying(10)) || '|'
|| CAST(pcant  AS character varying(10)) ;


/*crea el cargo*/
INSERT INTO
financiero.cargos(valoru,idmesa,cedula,idproducto,cant,nrocuenta,valor_iva,=
iva)
VALUES
(valorTOTAL,nromesa,pcedula,pidproducto,pcant,pnrocuenta,0,valores.iva);


    RETURN salida;

    =

END;
$$ LANGUAGE plpgsql;


execute : =

select financiero.marchar(1,1,1,'1');


result:
ERROR:  missing FROM-clause entry for table "=EF=BB=BFvalores"
LINE 1: SELECT =EF=BB=BFvalores.iva
               ^
QUERY:  SELECT =EF=BB=BFvalores.iva
CONTEXT:  PL/pgSQL function
financiero.marchar(integer,integer,integer,character varying) line 31 at
RAISE


********** Error **********

ERROR: missing FROM-clause entry for table "=EF=BB=BFvalores"
SQL state: 42P01
Context: PL/pgSQL function
financiero.marchar(integer,integer,integer,character varying) line 31 at
RAISE



table :


CREATE TABLE inventarios.productos
(
  idproducto integer NOT NULL,
  nombre character varying(200),
  valor integer,
  iva real DEFAULT 1.16,
  CONSTRAINT pk_producto PRIMARY KEY (idproducto)
)
WITH (
  OIDS=3DFALSE
);
ALTER TABLE inventarios.productos
  OWNER TO dba;

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: BUG #7783: lower & upper function incorrect work
Next
From: Aleksander Shniperson
Date:
Subject: Re: BUG #7783: lower & upper function incorrect work