[GENERAL] pgsql-general@postgresql.org

2010-08-18 Thread Sergey Sergeev
subscribe-set pgsql-general digest

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] pgsql-general@postgresql.org

2008-11-18 Thread Alvaro Herrera
Albe Laurenz wrote:
> Tomas Lanczos wrote:
> > I am using Postgresql to store all my research related data. At the 
> > moment I am just finishing my PhD thesis and I want to cite postgresql 
> > correctly but can't find how to do it. Could somebody give me an advice?
> 
> I'm not sure if the citation list is the right thing for software...
> 
> There's the name, "PostgreSQL". that should be written like this.
> There's the web site http://www.postgresql.org, which is the best reference.
> The people behind it are called "The PostgreSQL Global Development Group".

So maybe

@Misc{pgsql,
author  = "{P}ostgre{SQL} {G}lobal {D}evelopment {G}roup",
title   = "Postgre{SQL}",
howpublished = "\url{http://www.postgresql.org}";,
year= 2008
}

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] pgsql-general@postgresql.org

2008-11-18 Thread Albe Laurenz
Tomas Lanczos wrote:
> I am using Postgresql to store all my research related data. At the 
> moment I am just finishing my PhD thesis and I want to cite postgresql 
> correctly but can't find how to do it. Could somebody give me an advice?

I'm not sure if the citation list is the right thing for software...

There's the name, "PostgreSQL". that should be written like this.
There's the web site http://www.postgresql.org, which is the best reference.
The people behind it are called "The PostgreSQL Global Development Group".

Yours,
Laurenz Albe

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] pgsql-general@postgresql.org

2008-11-17 Thread Scott Marlowe
On Mon, Nov 17, 2008 at 11:09 AM, Tomas Lanczos <[EMAIL PROTECTED]> wrote:
> I am using Postgresql to store all my research related data. At the moment I
> am just finishing my PhD thesis and I want to cite postgresql correctly but
> can't find how to do it. Could somebody give me an advice?

You can start by looking at the wikipedia entry.  Not sure what you
mean by citing the db.  Are you looking at citing where it comes from,
who makes it, what?

It can be kinda tough to classify open source software... :)

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] pgsql-general@postgresql.org

2008-11-17 Thread Tomas Lanczos
I am using Postgresql to store all my research related data. At the 
moment I am just finishing my PhD thesis and I want to cite postgresql 
correctly but can't find how to do it. Could somebody give me an advice?


Many thanks

tomas

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] pgsql-general@postgresql.org

2007-04-24 Thread Albe Laurenz
> I am trying to use cursors and I am really frustrated already. Do  I
> need to install an extension?

No, it's all in the documentation:
http://www.postgresql.org/docs/current/static/plpgsql-control-structures
.html#PLPGSQL-RECORDS-ITERATING

> 1. Problem number one is that what ever I use in front of the fetch
> command it is not being accepted, it gives a syntax error. If I use a
> number ,"all" or "forward" it gives an error again?? I want to
> do something like the code below:
> 
> CREATE OR REPLACE FUNCTION database_correction()
>   RETURNS double precision AS
> $BODY$
> DECLARE
> mycursor CURSOR FOR select distinct(fund_id) from
> "NAV_values_bfb_history";
> iterator integer;
> 
> BEGIN
> open mycursor;
> 
> FETCH mycursor INTO iterator;
> 
> --fetch next  from  mycursor  --gives  an error
> 
> WHILE (FETCH next from mycursor) LOOP
> -- some computations here
> END LOOP;
> 
> CLOSE mycursor;
> END;

My suggestion:

$BODY$
DECLARE
a_row RECORD;
BEGIN
   FOR a_row IN SELECT DISTINCT(fund_id) FROM "NAV_values_bfb_history"
LOOP
  -- some computations here
  -- access the value as "a_row.fund_id"
   END LOOP;
END;
$BODY$

> 2. What is the right way to check that the cursor has ended. In
> sqlserver there is a variable "@@fetch_status". I have to make here
some
> comparison in the while clause, but I am not sure what it should be. I
> could not find a single example for cursor in a loop.

You do not need that at all, the loop will be left if there are no more
results.

Yours,
Laurenz Albe

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] pgsql-general@postgresql.org

2007-04-24 Thread Alvaro Herrera
Anton Andreev wrote:
> Hi,
> 
> I am trying to use cursors and I am really frustrated already. Do  I
> need to install an extension?

No, you just need to have a look at the docs.
http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING

> 1. Problem number one is that what ever I use in front of the fetch
> command it is not being accepted, it gives a syntax error. If I use a
> number ,"all" or "forward" it gives an error again?? I want to
> do something like the code below:
> 
> CREATE OR REPLACE FUNCTION database_correction()
>  RETURNS double precision AS
> $BODY$
> [...]

Try something like this:

CREATE OR REPLACE FUNCTION database_correction()
 RETURNS double precision LANGUAGE plpgsql AS
$body$
DECLARE
   fund INTEGER;
BEGIN
   FOR fund IN SELECT DISTINCT(fund_id) FROM "NAV_values_bfb_history" LOOP
 RAISE NOTICE $$ foo bar $$;
 -- some computations here
   END LOOP;
   RETURN 42.0;
END;
$body$;

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] pgsql-general@postgresql.org

2007-04-24 Thread Anton Andreev

Hi,

I am trying to use cursors and I am really frustrated already. Do  I
need to install an extension?

1. Problem number one is that what ever I use in front of the fetch
command it is not being accepted, it gives a syntax error. If I use a
number ,"all" or "forward" it gives an error again?? I want to
do something like the code below:

CREATE OR REPLACE FUNCTION database_correction()
 RETURNS double precision AS
$BODY$
DECLARE
   mycursor CURSOR FOR select distinct(fund_id) from
"NAV_values_bfb_history";
   iterator integer;

BEGIN
open mycursor;

FETCH mycursor INTO iterator;

--fetch next  from  mycursor  --gives  an error

WHILE (FETCH next from mycursor) LOOP
   -- some computations here
END LOOP;

CLOSE mycursor;
END;

2. What is the right way to check that the cursor has ended. In
sqlserver there is a variable "@@fetch_status". I have to make here some
comparison in the while clause, but I am not sure what it should be. I
could not find a single example for cursor in a loop.

I will greatly appreciate any help, pgsql is my database of choice.

Cheers,
Anton



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster