[postgis-users] add foreign-key constraint on raster import

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Wed May 14 08:27:48 PDT 2014


Shouldn't it be up to your app to add (if it does not exist yet) and set a key column every time a new raster is loaded? Or even better change the name of the raster before it is loaded so it gets a unique filename based on you users properties? The logic of identifying the files should be done before importing in the DB.

Pierre

> -----Original Message-----
> From: Max Demars [mailto:burton449geo at gmail.com]
> Sent: Wednesday, May 14, 2014 11:19 AM
> To: PostGIS Users Discussion
> Cc: Pierre Racine
> Subject: Re: [postgis-users] add foreign-key constraint on raster import
> 
> I was thinking about this way to do it, but my app has many users, and in
> case two rasters with the same filename are loaded, there would be a
> problem using filename to create a foreign key. The aim of the foreign key
> here would be to specify which user is the owner of which raster.
> 
> 
> I suppose I could find a way to handle the possibility of two rasters with the
> same filename, but if I could create the foreign key during the import, I
> think that would be the best.
> 
> 
> 
> On Wed, May 14, 2014 at 11:08 AM, Jason Mathis
> <jmathis at redzonesoftware.com> wrote:
> 
> 
> 	That what I was thinking too. Just to clarify its a capital “-F”.
> 
> 	Its a handy option for post processing the files in the db.
> 
> 	http://postgis.net/docs/using_raster_dataman.html#RT_Raster_Lo
> ader
> 
> 
> 
> 	On May 14, 2014 at 9:04:32 AM, Pierre Racine
> (pierre.racine at sbf.ulaval.ca) wrote:
> 
> 
> 		You can add the filename as a new column with the -f
> option. Then you can extract whatever you want from this column to build
> a key.
> 
> 		Does this works for you?
> 
> 		Pierre
> 
> 		> -----Original Message-----
> 		> From: postgis-users-bounces at lists.osgeo.org
> [mailto:postgis-users-
> 		> bounces at lists.osgeo.org] On Behalf Of Max Demars
> 		> Sent: Wednesday, May 14, 2014 10:08 AM
> 		> To: postgis-users at lists.osgeo.org
> 		> Subject: [postgis-users] add foreign-key constraint on
> raster import
> 		>
> 		> Hi,
> 		>
> 		>
> 		> I want to import many rasters from files into a same
> tablewith a foreign-key
> 		> constraint to be able to query them individually or
> grouped as needed.
> 		>
> 		>
> 		> I was hopping that the raster2pgsql tool would be able to
> do it, but no
> 		> chance.
> 		>
> 		> Is there a way to ask raster2pgsql to add a foreign-key
> during import? If
> 		> not, what would be the best approach for this purpose?
> 		>
> 		> Thank you very much,
> 		>
> 		>
> 		> -Max Demars
> 		>
> 		>
> 		> --
> 		>
> 		> Stack Overflow:
> http://stackoverflow.com/users/1914034/burton449
> 		>
> 		> GIS Overflow:
> http://gis.stackexchange.com/users/14426/burton449
> 		>
> 		> LastFm: http://www.lastfm.fr/user/burton449
> 
> 
> 	_______________________________________________
> 		postgis-users mailing list
> 		postgis-users at lists.osgeo.org
> 		http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-
> users
> 
> 
> 
> 	This transmission contains confidential and privileged information
> intended solely for the party identified above. If you receive this message in
> error, you must not use it or convey it to others. Please destroy it
> immediately and contact the sender at (303) 386-3955
> <tel:%28303%29%20386-3955>  or by return e-mail to the sender.
> 
> 
> 	_______________________________________________
> 	postgis-users mailing list
> 	postgis-users at lists.osgeo.org
> 	http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> 
> 
> 
> 
> 
> --
> 
> Stack Overflow: http://stackoverflow.com/users/1914034/burton449
> 
> GIS Overflow: http://gis.stackexchange.com/users/14426/burton449
> 
> LastFm: http://www.lastfm.fr/user/burton449



More information about the postgis-users mailing list