problems while upgrading postgis

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

problems while upgrading postgis

Paolo Importuni
Hi all,

I am trying to migrate my postgres/postgis instance from 2.0 to 2.2.2
The new  postgis.so library is in the right place and I found the right migration script postgis-2.0.0--2.2.2.sql.

I successfully upgraded three db instances by using the "ALTER EXTENSION postgis UPDATE TO '2.2.2';"  command, but it failed on one instance.

As far as I see, the problem might be that the postgis extension wasn't created using the "CREATE EXTENSION POSTGIS"  script, but maybe by some other methods.

If I try to create the extension, it fails saying "ERROR: type "spheroid" already exists"; if I try to upgrade it fails, saying that the extension postgis does not exist.

If I create a new db instance, create a new extension and then upgrade it to postgis 2.2. everything works fine.
Is a there  a way to sort it out?

Thanks and regards

Paolo

--
Paolo Importuni
Software Analyst and Developer
Modena, Italy

_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Sandro Santilli-4
On Wed, Nov 09, 2016 at 09:45:59AM +0100, Paolo Importuni wrote:

> I am trying to migrate my postgres/postgis instance from 2.0 to 2.2.2
> The new  postgis.so library is in the right place and I found the right
> migration script postgis-2.0.0--2.2.2.sql.
>
> I successfully upgraded three db instances by using the "ALTER EXTENSION
> postgis UPDATE TO '2.2.2';"  command, but it failed on one instance.
>
> As far as I see, the problem might be that the postgis extension wasn't
> created using the "CREATE EXTENSION POSTGIS"  script, but maybe by some
> other methods.
>
> If I try to create the extension, it fails saying "ERROR: type "spheroid"
> already exists"; if I try to upgrade it fails, saying that the extension
> postgis does not exist.
>
> If I create a new db instance, create a new extension and then upgrade it
> to postgis 2.2. everything works fine.
> Is a there  a way to sort it out?

To turn your non-extension install to an extension one, try this:

  CREATE EXTENSION POSTGIS VERSION '2.0.0' FROM 'unpackaged';

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   https://strk.kbt.io/services.html
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Paolo Importuni
Hi strk,
I've just tried but it complains that
"ERROR:  type "raster" does not exist"

Thanks for helping

Paolo
--
Paolo Importuni
Software Analyst and Developer
Modena, Italy

2016-11-09 11:12 GMT+01:00 Sandro Santilli <[hidden email]>:
On Wed, Nov 09, 2016 at 09:45:59AM +0100, Paolo Importuni wrote:

> I am trying to migrate my postgres/postgis instance from 2.0 to 2.2.2
> The new  postgis.so library is in the right place and I found the right
> migration script postgis-2.0.0--2.2.2.sql.
>
> I successfully upgraded three db instances by using the "ALTER EXTENSION
> postgis UPDATE TO '2.2.2';"  command, but it failed on one instance.
>
> As far as I see, the problem might be that the postgis extension wasn't
> created using the "CREATE EXTENSION POSTGIS"  script, but maybe by some
> other methods.
>
> If I try to create the extension, it fails saying "ERROR: type "spheroid"
> already exists"; if I try to upgrade it fails, saying that the extension
> postgis does not exist.
>
> If I create a new db instance, create a new extension and then upgrade it
> to postgis 2.2. everything works fine.
> Is a there  a way to sort it out?

To turn your non-extension install to an extension one, try this:

  CREATE EXTENSION POSTGIS VERSION '2.0.0' FROM 'unpackaged';

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   https://strk.kbt.io/services.html


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Sandro Santilli-4
On Wed, Nov 09, 2016 at 11:44:53AM +0100, Paolo Importuni wrote:
> Hi strk,
> I've just tried but it complains that
> "ERROR:  type "raster" does not exist"

This is because postgis _EXTENSION_ is forced to have
also raster in it :(

So the fix is for you to load raster script for 2.0.0

psql -f `pg_config --sharedir`/contrib/postgis-2.0/rtpostgis.sql <yourdb>

--strk;
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Paolo Importuni
Hi strk,
still problems, it says:
"You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application"

Do I need to apt-install postgresql-server-dev-X.Y? What's the use?

Thanks again

Paolo

2016-11-09 12:06 GMT+01:00 Sandro Santilli <[hidden email]>:
On Wed, Nov 09, 2016 at 11:44:53AM +0100, Paolo Importuni wrote:
> Hi strk,
> I've just tried but it complains that
> "ERROR:  type "raster" does not exist"

This is because postgis _EXTENSION_ is forced to have
also raster in it :(

So the fix is for you to load raster script for 2.0.0

psql -f `pg_config --sharedir`/contrib/postgis-2.0/rtpostgis.sql <yourdb>

--strk;


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Sandro Santilli-4
On Wed, Nov 09, 2016 at 06:33:28PM +0100, Paolo Importuni wrote:

> 2016-11-09 12:06 GMT+01:00 Sandro Santilli <[hidden email]>:
> > On Wed, Nov 09, 2016 at 11:44:53AM +0100, Paolo Importuni wrote:
> > >
> > > I've just tried but it complains that
> > > "ERROR:  type "raster" does not exist"
> >
> > This is because postgis _EXTENSION_ is forced to have
> > also raster in it :(
> >
> > So the fix is for you to load raster script for 2.0.0
> >
> > psql -f `pg_config --sharedir`/contrib/postgis-2.0/rtpostgis.sql <yourdb>
>
> still problems, it says:
> "You need to install postgresql-server-dev-X.Y for building a server-side
> extension or libpq-dev for building a client-side application"

Not the psql command I gave you above, right ?
Did you try that ? Or what are you doing ?

> Do I need to apt-install postgresql-server-dev-X.Y? What's the use?

If you're building PostGIS yourself  you need postgresql server headers.

--strk;
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Paolo Importuni


2016-11-09 20:27 GMT+01:00 Sandro Santilli <[hidden email]>:
On Wed, Nov 09, 2016 at 06:33:28PM +0100, Paolo Importuni wrote:
> 2016-11-09 12:06 GMT+01:00 Sandro Santilli <[hidden email]>:
> > On Wed, Nov 09, 2016 at 11:44:53AM +0100, Paolo Importuni wrote:
> > >
> > > I've just tried but it complains that
> > > "ERROR:  type "raster" does not exist"
> >
> > This is because postgis _EXTENSION_ is forced to have
> > also raster in it :(
> >
> > So the fix is for you to load raster script for 2.0.0
> >
> > psql -f `pg_config --sharedir`/contrib/postgis-2.0/rtpostgis.sql <yourdb>
>
> still problems, it says:
> "You need to install postgresql-server-dev-X.Y for building a server-side
> extension or libpq-dev for building a client-side application"

Not the psql command I gave you above, right ?
Did you try that ? Or what are you doing ?

I ran exactly the command you wrote and it says it
"You need to install postgresql-server-dev-X.Y for building a server-side
  extension or libpq-dev for building a client-side application"


> Do I need to apt-install postgresql-server-dev-X.Y? What's the use?

If you're building PostGIS yourself  you need postgresql server headers.

No I´m not doing that
--strk;

Thanks

Paolo


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Paolo Importuni
In reply to this post by Sandro Santilli-4
Sorry strk, it worked!  I was doing something wrong.

So resume for anyone interested:
I was trying to migrate from postgis 2.0 to 2.2
I successfully installed the postgis static library and had the migration script in place.
The soft upgrade works "ALTER EXTENSION postgis UPDATE TO '2.2.2';" works only if the db instance was spatially enabled by running the script "CREATE EXTENSION POSTGIS"
In case it wasn´t and as strk suggested, run the following steps:

CREATE EXTENSION POSTGIS VERSION '2.0.0' FROM 'unpackaged';
sudo -u postgres psql -d <yrdb> -f  rtpostgis.sql (in /usr/share/postgresql/9.1/contrib/postig-2.0/  on my instance)


Thank you very much for your support!
Paolo

2016-11-09 20:27 GMT+01:00 Sandro Santilli <[hidden email]>:
On Wed, Nov 09, 2016 at 06:33:28PM +0100, Paolo Importuni wrote:
> 2016-11-09 12:06 GMT+01:00 Sandro Santilli <[hidden email]>:
> > On Wed, Nov 09, 2016 at 11:44:53AM +0100, Paolo Importuni wrote:
> > >
> > > I've just tried but it complains that
> > > "ERROR:  type "raster" does not exist"
> >
> > This is because postgis _EXTENSION_ is forced to have
> > also raster in it :(
> >
> > So the fix is for you to load raster script for 2.0.0
> >
> > psql -f `pg_config --sharedir`/contrib/postgis-2.0/rtpostgis.sql <yourdb>
>
> still problems, it says:
> "You need to install postgresql-server-dev-X.Y for building a server-side
> extension or libpq-dev for building a client-side application"

Not the psql command I gave you above, right ?
Did you try that ? Or what are you doing ?

> Do I need to apt-install postgresql-server-dev-X.Y? What's the use?

If you're building PostGIS yourself  you need postgresql server headers.

--strk;


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: problems while upgrading postgis

Sandro Santilli-4
On Wed, Nov 09, 2016 at 09:18:06PM +0100, Paolo Importuni wrote:

> The soft upgrade works "ALTER EXTENSION postgis UPDATE TO '2.2.2';" works
> only if the db instance was spatially enabled by running the script "CREATE
> EXTENSION POSTGIS"
> In case it wasn´t and as strk suggested, run the following steps:
>
> CREATE EXTENSION POSTGIS VERSION '2.0.0' FROM 'unpackaged';
> sudo -u postgres psql -d <yrdb> -f  rtpostgis.sql
> (in /usr/share/postgresql/9.1/contrib/postig-2.0/  on my instance)

To be clear:
the second step (sourcing rtpostgis.sql) is actually only needed
IFF the first step fails due to raster not being loaded in <yrdb>,
and needs to be performed *before* the CREATE EXTENSION .. FROM
'unpackaged' line.

--strk;
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users