Raster Table Name With Upper-Case Characters

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.

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

Re: Raster Table Name With Upper-Case Characters

Hugues François
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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

Re: Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi Hugues,

Thanks for your response. Do you mean escape with a backslash as is done with most programming languages? Please, provide an example.

On Thu, Jul 13, 2017 at 11:27 AM, Hugues François <[hidden email]> wrote:
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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


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

Re: Raster Table Name With Upper-Case Characters

Hugues François
In reply to this post by Osahon Oduware
Yes, that's what I mean. I didn't try it but I think you need to tell raster2pgsql that double quotes are part of the string and not a simple text delimiter. 

It could look like something like this:
raster2pgsql raster_options_go_here raster_file someschema.\"sometable\"

Hug

Le 13 juil. 2017 1:13 PM, Osahon Oduware <[hidden email]> a écrit :
Hi Hugues,

Thanks for your response. Do you mean escape with a backslash as is done with most programming languages? Please, provide an example.

On Thu, Jul 13, 2017 at 11:27 AM, Hugues François <[hidden email]> wrote:
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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



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

Re: Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi Hugues,

I would try this out and give you feedback. Thanks.

On Thu, Jul 13, 2017 at 12:32 PM, Hugues François <[hidden email]> wrote:
Yes, that's what I mean. I didn't try it but I think you need to tell raster2pgsql that double quotes are part of the string and not a simple text delimiter. 

It could look like something like this:
raster2pgsql raster_options_go_here raster_file someschema.\"sometable\"

Hug

Le 13 juil. 2017 1:13 PM, Osahon Oduware <[hidden email]> a écrit :
Hi Hugues,

Thanks for your response. Do you mean escape with a backslash as is done with most programming languages? Please, provide an example.

On Thu, Jul 13, 2017 at 11:27 AM, Hugues François <[hidden email]> wrote:
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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



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


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

Re: Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi Hugues,

Using the backslash to escape the quotes as you suggested produces a syntax error.

On Thu, Jul 13, 2017 at 12:36 PM, Osahon Oduware <[hidden email]> wrote:
Hi Hugues,

I would try this out and give you feedback. Thanks.

On Thu, Jul 13, 2017 at 12:32 PM, Hugues François <[hidden email]> wrote:
Yes, that's what I mean. I didn't try it but I think you need to tell raster2pgsql that double quotes are part of the string and not a simple text delimiter. 

It could look like something like this:
raster2pgsql raster_options_go_here raster_file someschema.\"sometable\"

Hug

Le 13 juil. 2017 1:13 PM, Osahon Oduware <[hidden email]> a écrit :
Hi Hugues,

Thanks for your response. Do you mean escape with a backslash as is done with most programming languages? Please, provide an example.

On Thu, Jul 13, 2017 at 11:27 AM, Hugues François <[hidden email]> wrote:
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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



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



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

Re: Raster Table Name With Upper-Case Characters

Hugues François
Hi, 

I did some test using shp2pgsql because I didn't have available raster data on the computer I use from my holidays place.

It seems that it changes upper to lower case and already uses double quotes. Maybe, you coud try to proceed in several steps: first saving the output file of raster2pgsql, then uses sed to change its content with the correct syntax and finally uses psql command to execute le sql command file.

Regards,

Hug




De: "Osahon Oduware" <[hidden email]>
À: "PostGIS Users Discussion" <[hidden email]>
Envoyé: Jeudi 13 Juillet 2017 14:41:27
Objet: Re: [postgis-users] Raster Table Name With Upper-Case Characters

Hi Hugues,

Using the backslash to escape the quotes as you suggested produces a syntax error.

On Thu, Jul 13, 2017 at 12:36 PM, Osahon Oduware <[hidden email]> wrote:
Hi Hugues,

I would try this out and give you feedback. Thanks.

On Thu, Jul 13, 2017 at 12:32 PM, Hugues François <[hidden email]> wrote:
Yes, that's what I mean. I didn't try it but I think you need to tell raster2pgsql that double quotes are part of the string and not a simple text delimiter. 

It could look like something like this:
raster2pgsql raster_options_go_here raster_file someschema.\"sometable\"

Hug

Le 13 juil. 2017 1:13 PM, Osahon Oduware <[hidden email]> a écrit :
Hi Hugues,

Thanks for your response. Do you mean escape with a backslash as is done with most programming languages? Please, provide an example.

On Thu, Jul 13, 2017 at 11:27 AM, Hugues François <[hidden email]> wrote:
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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



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



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


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

Re: Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi Hugues,

Thanks for your suggestion. I would attempt this on a small raster and give you feedback. However, in practice I am working with a large raster, hence, I am piping the output of the raster2pgsql command with the connection to the database as below:
raster2pgsql -s <SRID> -d -Y -e -I -C -F -M /path/to/raster/file <RASTER_TABLE> | psql -h localhost -U postgres -p 5432 -d <database>


On Fri, Jul 14, 2017 at 8:51 AM, Hugues François <[hidden email]> wrote:
Hi, 

I did some test using shp2pgsql because I didn't have available raster data on the computer I use from my holidays place.

It seems that it changes upper to lower case and already uses double quotes. Maybe, you coud try to proceed in several steps: first saving the output file of raster2pgsql, then uses sed to change its content with the correct syntax and finally uses psql command to execute le sql command file.

Regards,

Hug




De: "Osahon Oduware" <[hidden email]>
À: "PostGIS Users Discussion" <[hidden email]>
Envoyé: Jeudi 13 Juillet 2017 14:41:27
Objet: Re: [postgis-users] Raster Table Name With Upper-Case Characters

Hi Hugues,

Using the backslash to escape the quotes as you suggested produces a syntax error.

On Thu, Jul 13, 2017 at 12:36 PM, Osahon Oduware <[hidden email]> wrote:
Hi Hugues,

I would try this out and give you feedback. Thanks.

On Thu, Jul 13, 2017 at 12:32 PM, Hugues François <[hidden email]> wrote:
Yes, that's what I mean. I didn't try it but I think you need to tell raster2pgsql that double quotes are part of the string and not a simple text delimiter. 

It could look like something like this:
raster2pgsql raster_options_go_here raster_file someschema.\"sometable\"

Hug

Le 13 juil. 2017 1:13 PM, Osahon Oduware <[hidden email]> a écrit :
Hi Hugues,

Thanks for your response. Do you mean escape with a backslash as is done with most programming languages? Please, provide an example.

On Thu, Jul 13, 2017 at 11:27 AM, Hugues François <[hidden email]> wrote:
Hi,

Did you try to escape double quotes in the raster2pgsql command line ?

Regards,
Hug


Le 13 juil. 2017 12:21 PM, Osahon Oduware <[hidden email]> a écrit :
Hi All,

I wanted to know if there is a way to specify a raster table name with Upper-Case characters using the raster2pgsql tool. I have tried enclosing the table name in double-quotes, but the raster2pgsql tool seems to convert it to Lower-Case characters.

Knowing how to do this would save me from the current challenge of renaming the raster table after they have been created (see the link below):
Renaming Raster Table

I would be glad if someone could help me with this.


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



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



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


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


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

Re: Raster Table Name With Upper-Case Characters

Mateusz Loskot
On 14 July 2017 at 12:44, Osahon Oduware <[hidden email]> wrote:
>
> Thanks for your suggestion. I would attempt this on a small raster and give
> you feedback. However, in practice I am working with a large raster, hence,
> I am piping the output of the raster2pgsql command with the connection to
> the database as below:
> raster2pgsql -s <SRID> -d -Y -e -I -C -F -M /path/to/raster/file
> <RASTER_TABLE> | psql -h localhost -U postgres -p 5432 -d <database>
>

If you scanned the docs you would have learned about -q option.

(reading PostgreSQL docs on quoted identifiers might be useful too).

If quoted identifiers are not requested, raster2pgsql forces database
object names (schema/table...) to lowercase.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi Mateusz,

I have just tried using the -q option and it works. Thanks a lot. I have gone through the doc a lot to resolve several issues in the past. In this case it was an oversight as I thought that explicitly wrapping the identifiers in quote would give the same result as the -q option.


On Fri, Jul 14, 2017 at 12:10 PM, Mateusz Loskot <[hidden email]> wrote:
On 14 July 2017 at 12:44, Osahon Oduware <[hidden email]> wrote:
>
> Thanks for your suggestion. I would attempt this on a small raster and give
> you feedback. However, in practice I am working with a large raster, hence,
> I am piping the output of the raster2pgsql command with the connection to
> the database as below:
> raster2pgsql -s <SRID> -d -Y -e -I -C -F -M /path/to/raster/file
> <RASTER_TABLE> | psql -h localhost -U postgres -p 5432 -d <database>
>

If you scanned the docs you would have learned about -q option.

(reading PostgreSQL docs on quoted identifiers might be useful too).

If quoted identifiers are not requested, raster2pgsql forces database
object names (schema/table...) to lowercase.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


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

Re: Raster Table Name With Upper-Case Characters

Mateusz Loskot
On 14 July 2017 at 14:27, Osahon Oduware <[hidden email]> wrote:
> Hi Mateusz,
>
> I have just tried using the -q option and it works. Thanks a lot. I have
> gone through the doc a lot to resolve several issues in the past. In this
> case it was an oversight as I thought that explicitly wrapping the
> identifiers in quote would give the same result as the -q option.

raster2pgsql is modelled after shp2pgsql, in terms of capabilities,
so you shouldn't need any quoting/escaping gymnastics to tell the loaders
what case of names you want.

It might have been easier if raster2pgsql used -k as shp2pgsql does,
but -k is taken by different option.

raster2pgsql docs on -q could have been clearer though.
Patches are welcome.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Raster Table Name With Upper-Case Characters

Osahon Oduware
Hi Mateusz,

I agree with you. Thanks a lot.

On Fri, Jul 14, 2017 at 1:36 PM, Mateusz Loskot <[hidden email]> wrote:
On 14 July 2017 at 14:27, Osahon Oduware <[hidden email]> wrote:
> Hi Mateusz,
>
> I have just tried using the -q option and it works. Thanks a lot. I have
> gone through the doc a lot to resolve several issues in the past. In this
> case it was an oversight as I thought that explicitly wrapping the
> identifiers in quote would give the same result as the -q option.

raster2pgsql is modelled after shp2pgsql, in terms of capabilities,
so you shouldn't need any quoting/escaping gymnastics to tell the loaders
what case of names you want.

It might have been easier if raster2pgsql used -k as shp2pgsql does,
but -k is taken by different option.

raster2pgsql docs on -q could have been clearer though.
Patches are welcome.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Loading...