X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E6179DCBDE for ; Sun, 19 Feb 2006 14:47:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41884-03 for ; Sun, 19 Feb 2006 14:47:26 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by postgresql.org (Postfix) with ESMTP id B6CD19DCB4B for ; Sun, 19 Feb 2006 14:47:24 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so735617nzp for ; Sun, 19 Feb 2006 10:47:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=EkbVUyVWyS426M6i0LWLo8TWPThP5Zs/5cM5zkVewo1rm2i5Y7WeLZRAS2B2650vpmPiKJP4ZdkDh5N5Esy6xshBa+bCBcSTQv5fLT0PEtS6tbhzLU9pfne9UFLHcDPMnLDgnnCoP4rBRP+mMEK5evKZJ/a887rDdOshKhUbiWc= Received: by 10.64.181.15 with SMTP id d15mr281319qbf; Sun, 19 Feb 2006 10:47:22 -0800 (PST) Received: by 10.65.206.4 with HTTP; Sun, 19 Feb 2006 10:47:21 -0800 (PST) Message-ID: <2bffcc330602191047w6338e67aw77145989046f93d6@mail.gmail.com> Date: Sun, 19 Feb 2006 13:47:21 -0500 From: "Henry Ortega" To: "Owen Jacobson" Subject: Re: Given 02-01-2006 to 02-28-2006, output all days. Cc: pgsql-sql@postgresql.org In-Reply-To: <144D12D7DD4EC04F99241498BB4EEDCC220D78@nelson.osl.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9970_30231183.1140374841326" References: <144D12D7DD4EC04F99241498BB4EEDCC220D78@nelson.osl.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.092 required=5 tests=[AWL=0.094, HTML_MESSAGE=0.001, URI_NOVOWEL=0.997] X-Spam-Score: 1.092 X-Spam-Level: * X-Archive-Number: 200602/242 X-Sequence-Number: 24252 ------=_Part_9970_30231183.1140374841326 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I was able to find a suitable 7.3.2 plpgsql.so and now plpgsql works. (supposedly) I am trying out some really basic function creation such as this: create function dng2(start_date DATE) returns setof date as $$ declare aa date:=3Dstart_date; But I always get this ERROR: parser: parse error at or near "DATE" at character 33 before I can even finish. Any idea why this happens? On 2/17/06, Owen Jacobson wrote: > > That usually indicates that, for whatever reason, plpgsql.so is from a > different version of PostgreSQL than the database server. If you install= ed > PostgreSQL from source, make sure you configured the server to look in th= e > same lib dir as its libs were installed to; if you've installed from pack= age > management of some kind (RPM?) make sure you have the same versions of al= l > postgres-related packages. > > You should also upgrade, if possible. 7.3 is effectively obsolete (37 > releases old); there are a number of bugfixes and performance improvement= s > in more recent versions. > > -Owen > > -----Original Message----- > From: Henry Ortega [mailto:juandelacruz@gmail.com] > Sent: Friday, February 17, 2006 2:06 PM > To: Owen Jacobson > Subject: Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days. > > > This sounds good. I don't have plpgsql loaded though. > > I am trying to load plpgsql and it's giving me: > ERROR: Load of file /usr/lib/pgsql/plpgsql.so failed: > /usr/lib/pgsql/plpgsql.so: undefined symbol: xlateSqlType > createlang: language installation failed > > I have pgsql 7.3.2 > I am googling and can't seem to find the answer. Any help would be > appreciated. > > > On 2/17/06, Owen Jacobson wrote: > Henry Ortega wrote: > > (question about set of all days between two dates) > > I don't know of a builtin way to do it off the top of my head, but it's a > pretty simple function to write: > > create function days (start date, finish date) returns setof date as $$ > declare > curdate date; > begin > curdate :=3D start; > while (curdate <=3D finish) loop > return next curdate; > curdate :=3D curdate + 1; > end loop; > return; > end; > $$ language plpgsql; > > # select * from days ('2006-02-01', '2006-02-07'); > days > ------------ > 2006-02-01 > 2006-02-02 > 2006-02-03 > 2006-02-04 > 2006-02-05 > 2006-02-06 > 2006-02-07 > (7 rows) > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > ------=_Part_9970_30231183.1140374841326 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I was able to find a suitable 7.3.2 plpgsql.so and now plpgsql works. (supp= osedly)

I am trying out some really basic function creation such as = this:

create function dng2(start_date DATE) returns setof date as $$
declare
aa date:=3Dstart_date;

But I always get this
ERROR:  parser: parse error at or near &= quot;DATE" at character 33
before I can even finish.

= Any idea why this happens?




On 2/17/06, Owen Jacobson <ojacobson@osl.com> wrote:
That usually indicates that, for whatever reason, plpgsql.so is from a diff= erent version of PostgreSQL than the database server.  If you ins= talled PostgreSQL from source, make sure you configured the server to look = in the same lib dir as its libs were installed to; if you've installed from= package management of some kind (RPM?) make sure you have the same version= s of all postgres-related packages.

You should also upgrade, if possible.  7.3 is effectively= obsolete (37 releases old); there are a number of bugfixes and performance= improvements in more recent versions.

-Owen

-----Original Me= ssage-----
From: Henry Ortega [mailto:ju= andelacruz@gmail.com]
Sent: Friday, February 17, 2006 2:06 PM
To:= Owen Jacobson
Subject: Re: [SQL] Given 02-01-2006 to 02-28-2006, output= all days.


This sounds good. I don't have plpgsql loaded though.

I = am trying to load plpgsql and it's giving me:
ERROR:  Load of = file /usr/lib/pgsql/plpgsql.so failed: /usr/lib/pgsql/plpgsql.so: undefined= symbol: xlateSqlType
createlang: language installation failed

I have pgsql 7.3.2
I= am googling and can't seem to find the answer. Any help would be appreciat= ed.


On 2/17/06, Owen Jacobson < ojacobson@osl.com> wrote:
Henry Ortega wrote:

(question ab= out set of all days between two dates)

I don't know of a builtin way= to do it off the top of my head, but it's a pretty simple function to writ= e:

create function days (start date, finish date) returns setof date a= s $$
declare
  curdate date;
begin
  curdat= e :=3D start;
  while (curdate <=3D finish) loop
 &= nbsp;  return next curdate;
    curdate := =3D curdate + 1;
  end loop;
  return;
end;
$$ language plp= gsql;

# select * from days ('2006-02-01', '2006-02-07');
 &n= bsp;  days
------------
2006-02-01
2006-02-02
2006-02= -03
2006-02-04
2006-02-05
2006-02-06
2006-02-07
(7 rows)


---------------------------(end of br= oadcast)---------------------------
TIP 5: don't forget to increase your= free space map settings

------=_Part_9970_30231183.1140374841326--