Re: compile postgres with visual studio 2010

Lists: pgsql-general
From: Rebecca Clarke <rebecca(at)clarke(dot)net(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Error creating function
Date: 2011-07-20 10:41:11
Message-ID: CANY3h+QGswUfiQZNVQJazR1q7nkzXy-2OwHP+_to7846VZq94g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi

I'm doing a restore into Postgresql 8.4, postgis 1.5.1 and I'm getting the
following error when it creates the below function:

pg_restore: creating FUNCTION _get_buffer(geometry, double precision,
integer)
pg_restore: [archiver (db)] Error from TOC entry 966; 1255 49162661 FUNCTION
_get_buffer(geometry, double precision, integer) postgres
pg_restore: [archiver (db)] could not execute query: ERROR: SQL function
cannot accept shell type geometry
Command was: CREATE FUNCTION _get_buffer(_geom geometry, _radius double
precision, _density integer, OUT the_geom geometry) RETURNS geome...

I don't understand what 'cannot accept shell type geometry' means? Can
anyone help my lack of knowledge?

Thanks

Rebecca


From: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: compile postgres with visual studio 2010
Date: 2011-07-20 10:56:34
Message-ID: 2C0926ABD16BB641A8E2F11A54920042297FE33FE7@PHXCCRPRD01.adprod.bmc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi

I would like to build Postgres from source with the visual studio 2010 compiler

Is it supported? Is there any document which describes the process of the implementation?

Thanks,

Yuval Sofer

BMC Software

CTM&D Business Unit

DBA Team

972-52-4286-282

yuval_sofer(at)bmc(dot)com<mailto:yuval_sofer(at)bmc(dot)com>


From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: compile postgres with visual studio 2010
Date: 2011-07-20 11:50:32
Message-ID: 4E26C108.4070106@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 20/07/2011 11:56, Sofer, Yuval wrote:
> Hi
>
>
>
> I would like to build Postgres from source with the visual studio 2010
> compiler
>
> Is it supported? Is there any document which describes the process of
> the implementation?

Yes, it's in the Fine Manual:

http://www.postgresql.org/docs/9.0/static/install-windows.html

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: compile postgres with visual studio 2010
Date: 2011-07-20 14:33:59
Message-ID: 10908.1311172439@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

"Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com> writes:
> I would like to build Postgres from source with the visual studio 2010 compiler

> Is it supported?

Not yet. You could test the pending patch for that:
https://commitfest.postgresql.org/action/patch_view?id=523

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rebecca Clarke <rebecca(at)clarke(dot)net(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error creating function
Date: 2011-07-20 14:46:09
Message-ID: 11172.1311173169@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Rebecca Clarke <rebecca(at)clarke(dot)net(dot)nz> writes:
> I'm doing a restore into Postgresql 8.4, postgis 1.5.1 and I'm getting the
> following error when it creates the below function:

> pg_restore: creating FUNCTION _get_buffer(geometry, double precision,
> integer)
> pg_restore: [archiver (db)] Error from TOC entry 966; 1255 49162661 FUNCTION
> _get_buffer(geometry, double precision, integer) postgres
> pg_restore: [archiver (db)] could not execute query: ERROR: SQL function
> cannot accept shell type geometry
> Command was: CREATE FUNCTION _get_buffer(_geom geometry, _radius double
> precision, _density integer, OUT the_geom geometry) RETURNS geome...

> I don't understand what 'cannot accept shell type geometry' means? Can
> anyone help my lack of knowledge?

Hmm, that is interesting. A "shell" type is a SQL base data type that
has been declared to the database but its properties are not yet filled
in. This is needed because the properties include I/O functions, which
have to be declared to take or return the data type, so there's a
circularity involved. The standard solution is

CREATE TYPE typename; -- this creates typename as a shell

CREATE FUNCTION typename_in(cstring) RETURNS typename ...

CREATE FUNCTION typename_out(typename) RETURNS cstring ...

CREATE TYPE typename (input = typename_in, output = typename_out, ...);

The last step changes the type from a shell into a real, usable
datatype.

So what you've apparently got is a situation where that last step got
missed for the geometry type, or else the _get_buffer function somehow
got inserted into the middle of this sequence. I've not heard of that
happening to people before, so I wonder if you could provide the exact
step-by-step of what you did.

regards, tom lane


From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: compile postgres with visual studio 2010
Date: 2011-07-21 03:16:08
Message-ID: 4E2799F8.1040100@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 20/07/11 18:56, Sofer, Yuval wrote:

> I would like to build Postgres from source with the visual studio 2010
> compiler

Unless you're willing to use the patch Tom linked to, you should compile
with Visual Studio 2008 or with the Microsoft Platform SDK 7.0 (Windows
Vista and .NET 3.5).

More testing of the VS 2010 patches would be appreciated, so it'd be
great if you did give them a go.

--
Craig Ringer


From: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: compile postgres with visual studio 2010
Date: 2011-07-21 06:56:51
Message-ID: 2C0926ABD16BB641A8E2F11A54920042297FE347B4@PHXCCRPRD01.adprod.bmc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi

Ok - but how do I install the patch in the link?

I pressed the latest "patch" link Tom Lane gave me (Patch by brar on 2011-07-07 12:37:47 AM: Added documentation, removed pgflex.pl and pgbison.pl. No changes to the existing code. ), where I saw some correspondence and very long text file (perl).

Is there a utility for applying the patch, or a README document for step by step implementation?

Regards,
Yuval

-----Original Message-----
From: Craig Ringer [mailto:craig(at)postnewspapers(dot)com(dot)au]
Sent: Thursday, 21 July 2011 06:16 a.m.
To: Sofer, Yuval
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] compile postgres with visual studio 2010

On 20/07/11 18:56, Sofer, Yuval wrote:

> I would like to build Postgres from source with the visual studio 2010
> compiler

Unless you're willing to use the patch Tom linked to, you should compile
with Visual Studio 2008 or with the Microsoft Platform SDK 7.0 (Windows
Vista and .NET 3.5).

More testing of the VS 2010 patches would be appreciated, so it'd be
great if you did give them a go.

--
Craig Ringer


From: Brar Piening <brar(at)gmx(dot)de>
To: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: compile postgres with visual studio 2010
Date: 2011-07-21 11:56:28
Message-ID: 4E2813EC.2050505@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

-------- Original Message --------
Subject: Re: [GENERAL] compile postgres with visual studio 2010
From: Sofer, Yuval <Yuval_Sofer(at)bmc(dot)com>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Date: 21.07.2011 08:56
> Hi
>
> Ok - but how do I install the patch in the link?
>
> I pressed the latest "patch" link Tom Lane gave me (Patch by brar on 2011-07-07 12:37:47 AM: Added documentation, removed pgflex.pl and pgbison.pl. No changes to the existing code. ), where I saw some correspondence and very long text file (perl).
>
> Is there a utility for applying the patch, or a README document for step by step implementation?
>
In short (for the records): download and install msysgit from
http://code.google.com/p/msysgit/downloads/list
Open git bash and cd into an empty directory like:
cd c:
mkdir pgdev
cd pgdev

Clone the postgresql repository:
git clone git://git.postgresql.org/git/postgresql.git
cd postgresql

Copy the patch (the part with the strange perl-like text of the
message) from
http://archives.postgresql.org/message-id/4E14FD1A.8080703@gmx.de and
save it to a file (like VS2010v9.patch) which you put into the directory
which contains your newly created repository (c:\pgdev).

Apply the Patch:
patch -Ec -p 1 -i ../VS2010v9.patch
(which doesn't seem to apply cleanly anymore which will break things for
you - but I currently have no time to fix it)

Put bison and flex into your path like:
echo "\$ENV{PATH}=\$ENV{PATH} . ';C:\Program Files (x86)\Git\bin';" >
src/tools/msvc/buildenv.pl
(you might have to adopt the path)

Open a Visual Studio 2010 command prompt and cd into the src/tools/msvc
directory of your repository like:
cd C:\pgdev\postgresql\src\tools\msvc

Start the build:
build.bat
(which will break because of the fact that the patch didn't apply cleanly)

I'll take care of the patch as soon as I can (which will not be before
this weekend).
I'm sorry for the bad state of the patch but I've been keepnig it up to
date for months now which isn't always easy.

Regards,
Brar


From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: compile postgres with visual studio 2010
Date: 2011-07-21 12:11:47
Message-ID: 4E281783.8030002@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 21/07/2011 2:56 PM, Sofer, Yuval wrote:
> Hi
>
> Ok - but how do I install the patch in the link?
>
> I pressed the latest "patch" link Tom Lane gave me (Patch by brar on 2011-07-07 12:37:47 AM: Added documentation, removed pgflex.pl and pgbison.pl. No changes to the existing code. ), where I saw some correspondence and very long text file (perl).
If you're asking that question, it might be best if you just compile
with Visual Studio 2008 and wait for VS 2010 support to come out in
(hopefully) the next release. Especially since Brian says the patch no
longer corresponds with git master, so you'd need to make code changes
to get it to apply correctly.

I strongly recommend that you use Visual Studio 2008 (the free Express
Edition works and is still available for download) or use the free
Windows SDK for Vista and .NET 3.5.

You can get the SDK from here:
http://www.microsoft.com/download/en/details.aspx?id=11310

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/


From: Rebecca Clarke <rebecca(at)clarke(dot)net(dot)nz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error creating function
Date: 2011-07-21 13:53:53
Message-ID: CANY3h+Rvcik3V7HWUyRo6_fNNV_jjCp+xrVQw2qtJ_rWJqh+0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi Tom

Thanks for your reply. I was restoring one schema (with data) at a time from
8.3 db to a pre-created empty 8.4 db. I received a lot of errors which game
down to me not restoring the public schema first. I also realized, I had not
created plpgsql language for the 8.4 db before I did the restoration. So
after I created the language and restarted the restoration from scratch with
the public schema first, I no longer received this error.

Thanks

Rebecca

On Wed, Jul 20, 2011 at 3:46 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Rebecca Clarke <rebecca(at)clarke(dot)net(dot)nz> writes:
> > I'm doing a restore into Postgresql 8.4, postgis 1.5.1 and I'm getting
> the
> > following error when it creates the below function:
>
> > pg_restore: creating FUNCTION _get_buffer(geometry, double precision,
> > integer)
> > pg_restore: [archiver (db)] Error from TOC entry 966; 1255 49162661
> FUNCTION
> > _get_buffer(geometry, double precision, integer) postgres
> > pg_restore: [archiver (db)] could not execute query: ERROR: SQL function
> > cannot accept shell type geometry
> > Command was: CREATE FUNCTION _get_buffer(_geom geometry, _radius
> double
> > precision, _density integer, OUT the_geom geometry) RETURNS geome...
>
> > I don't understand what 'cannot accept shell type geometry' means? Can
> > anyone help my lack of knowledge?
>
> Hmm, that is interesting. A "shell" type is a SQL base data type that
> has been declared to the database but its properties are not yet filled
> in. This is needed because the properties include I/O functions, which
> have to be declared to take or return the data type, so there's a
> circularity involved. The standard solution is
>
> CREATE TYPE typename; -- this creates typename as a shell
>
> CREATE FUNCTION typename_in(cstring) RETURNS typename ...
>
> CREATE FUNCTION typename_out(typename) RETURNS cstring ...
>
> CREATE TYPE typename (input = typename_in, output = typename_out,
> ...);
>
> The last step changes the type from a shell into a real, usable
> datatype.
>
> So what you've apparently got is a situation where that last step got
> missed for the geometry type, or else the _get_buffer function somehow
> got inserted into the middle of this sequence. I've not heard of that
> happening to people before, so I wonder if you could provide the exact
> step-by-step of what you did.
>
> regards, tom lane
>