error en una funcion al utilizar select into con 2 esquemas

Lists: Postg와이즈 토토SQL
From: "Crispin T(dot)" <cris(dot)emis(at)gmail(dot)com>
To: pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: error en una funcion al utilizar select into con 2 esquemas
Date: 2012-07-13 21:47:27
Message-ID: CAMb9RiM81yg_cbPJ4ZzqL1gR4WuBer=G9E1uJ4sxwA2yJsFKwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg와이즈 토토SQL

Saludos

tengo el siguiente problema.

cree una funcion en plpgsql en la cual se realisan varios procesos (insert,
delete, drop table y otros) pero tengo un problema cuando llega a esta
sentencia

*select id,fecha, expiracion,titulo,descripcion into web.noticias_web
from noticia where eliminado is not true and expiracion > now(); *

el error que me da es el siguiente:
*ERROR: «web.noticias_web» no es una variable conocida*

NOTA: lineas mas arriba ejecuto sin problemas
*drop table web.noticias_web;*

alguien tiene alguna idea de porque el select into no funciona?
ya que ejecutando solo la linea funciona sin problemas pero una ves dentro
de la funcion da el error que comente.

la funcion se ejecuta normalmente si pongo la linea del select into dentro
del comando execute
*execute 'select id,fecha, expiracion,titulo,descripcion into
web.noticias_web from noticia where eliminado is not true and expiracion >
now(); ';*


From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Crispin T(dot) <cris(dot)emis(at)gmail(dot)com>
Cc: Ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: error en una funcion al utilizar select into con 2 esquemas
Date: 2012-07-13 22:11:21
Message-ID: 1342217418-sup-2072@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-es-ayuda


Excerpts from Crispin T.'s message of vie jul 13 17:47:27 -0400 2012:
> Saludos
>
> tengo el siguiente problema.
>
> cree una funcion en plpgsql en la cual se realisan varios procesos (insert,
> delete, drop table y otros) pero tengo un problema cuando llega a esta
> sentencia
>
> *select id,fecha, expiracion,titulo,descripcion into web.noticias_web
> from noticia where eliminado is not true and expiracion > now(); *
>
> el error que me da es el siguiente:
> *ERROR: «web.noticias_web» no es una variable conocida*

SELECT INTO tiene un significado diferente dentro de plpgsql (asigna el
valor a una variable) que fuera (inserta los registros del resultado en
una tabla). Usa INSERT INTO .. SELECT para evitar el problema.

--
Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>