<div dir="ltr"><div><div>Yes Pierre, very clever! I suppose that could be a workaround. Maybe not my first choice solution though...<br></div>Thanks a lot!<br><br></div>-Max Demars<br></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Wed, May 14, 2014 at 11:27 AM, Pierre Racine <span dir="ltr"><<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>

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