Strange syntax with select

Поиск
Список
Период
Сортировка
От Edson F. Lidorio
Тема Strange syntax with select
Дата
Msg-id 567D4335.1050506@openmailbox.org
обсуждение исходный текст
Ответы Re: Strange syntax with select  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: Strange syntax with select  ("Charles Clavadetscher" <clavadetscher@swisspug.org>)
Список pgsql-general
Hello,
I excuse my ignorance with SQL and my English.
I wonder if these procedures are correct or is it a bug?
I'm trying to put the result of a select within the v_saldo_ini variable, except I realized that the postgresql created a table with v_saldo_ini variable.

See the steps below:

CREATE TABLE contas
(
   vlr_saldo_inicial numeric(14,2)) ;

select sum(vlr_saldo_inicial) as saldo_ini
into v_saldo_ini
from contas;

--postgresql created v_saldo_ini table

select * from v_saldo_ini;
 saldo_ini
-----------
  20000.00
(
1 record)


--if I executat = ro select below, returns the table v_saldo_ini already exists

select sum(vlr_saldo_inicial) as saldo_ini
 into v_saldo_ini
from contas;

ERROR: relation "v_saldo_ini" already exists


I'm using version below PostgreSQL.

PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit

--
Edson

В списке pgsql-general по дате отправления:

Предыдущее
От: Amit Bondwal
Дата:
Сообщение: Re: BDR error while adding 3rd node to cluster
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Strange syntax with select