[SQL] Problem with serial counters

2011-02-25 Thread Jacques Lebrun
When I install my application, I use a SQL script to create the different tables. Most of my tables start with a Serial column called RowId. In my setup script I insert a few records into some tables, providing all fields, including the RowId (1, 2, 3, etc). The problem I have is that when my

[SQL] what's wrong in this procedure?

2011-02-25 Thread Camaleon
This error is returned Erro de SQL: ERROR: column Aguardando Pagto does not exist at character 352 create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS ' SELECT o.data_fim, sum(t.num_itens * t.valor) AS total, count(t.*) AS transacoes FROM ofertas

Re: [SQL] what's wrong in this procedure?

2011-02-25 Thread Adrian Klaver
On 02/25/2011 09:46 AM, Camaleon wrote: This error is returned Erro de SQL: ERROR: column Aguardando Pagto does not exist at character 352 create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS ' SELECT o.data_fim, sum(t.num_itens * t.valor) AS total,

Re: [SQL] what's wrong in this procedure?

2011-02-25 Thread Yeb Havinga
On 2011-02-25 19:33, Adrian Klaver wrote: On 02/25/2011 09:46 AM, Camaleon wrote: This error is returned Erro de SQL: ERROR: column Aguardando Pagto does not exist at character 352 create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS ' SELECT

Re: [SQL] Problem with serial counters

2011-02-25 Thread Vibhor Kumar
On Feb 25, 2011, at 2:39 AM, Jacques Lebrun wrote: What can I do to force PostGres to update the internat serial counter when I do an insert with a specified value for the serial? After inserting the all the Data, use ALTER SEQUENCE Command:

Re: [SQL] what's wrong in this procedure?

2011-02-25 Thread Rob Sargent
On 02/25/2011 10:46 AM, Camaleon wrote: This error is returned Erro de SQL: ERROR: column Aguardando Pagto does not exist at character 352 create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS ' SELECT o.data_fim, sum(t.num_itens * t.valor)