Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assign_vertex_id() #16

Closed
antonpa opened this issue Nov 15, 2010 · 8 comments
Closed

assign_vertex_id() #16

antonpa opened this issue Nov 15, 2010 · 8 comments
Milestone

Comments

@antonpa
Copy link
Contributor

antonpa commented Nov 15, 2010

hi friends my english language is poor.i want to use assign_vertex_id() with SCHEMA name. for example i need use: select assign_vertex_id('baharestan.roads', 0.001, 'the_geom', 'gid'); but it has this error:

NOTICE: CREATE TABLE will create implicit sequence "vertices_tmp_id_seq" for serial column "vertices_tmp.id" CONTEXT: SQL statement "CREATE TABLE vertices_tmp (id serial)" PL/pgSQL function "assign_vertex_id" line 21 at EXECUTE statement ERROR: relation "baharestan.roads" does not exist CONTEXT: SQL statement "SELECT count(*) as countids FROM "baharestan.roads"" PL/pgSQL function "assign_vertex_id" line 28 at FOR over EXECUTE statement

thanks a lot

@antonpa
Copy link
Contributor Author

antonpa commented Nov 15, 2010

I have the same problem. "assign_vertex_id" works if I run it on a table of roads (made from Tiger 2009 shapefiles) that was created in the public schema, but if I create it in any other schema, I get that error he listed, whether I qualify the table name with the schema prefix or not.

@justjkk
Copy link
Contributor

justjkk commented Aug 23, 2011

I modified assign_vertex_id to accept an optional schema name. I have a doubt regarding which schema 'vertices_tmp' table should be created in. Check this branch: https://github.com/pgRouting/pgrouting/commits/issue16

@woodbri
Copy link
Contributor

woodbri commented May 14, 2013

I don't see a need for this. you can change your search path before you run the command. Or you can write a trivial wrapper the changes the search path then execute the original command. I don't think we want to add schema to all our commands, and I can't see any overriding reason that this should get it and the others should not.

@woodbri woodbri closed this as completed May 14, 2013
@dkastl
Copy link
Member

dkastl commented May 16, 2013

I agree with Steve as if we add "schema" here we have to add it everywhere.
Better would be that when a function takes a table name as parameter, then this parameter should also work as schema.table.

@woodbri
Copy link
Contributor

woodbri commented May 16, 2013

This is a little bit problematic from the point of view that we should be passing table name through quote_ident(tablename) which results in:

pgr_test=# select quote_ident('schema.table');
  quote_ident
---------------
 "schema.table"

which is NOT what we want. What we need is "schema"."table". We could write a utility function like
pgr_quote_ident() that splits the string on the '.' and passes each of the components through qoute_ident() and reassembles the string. Then change of the code to use that.

@dkastl
Copy link
Member

dkastl commented May 16, 2013

This utility function sounds like a good idea to me.

@woodbri
Copy link
Contributor

woodbri commented May 16, 2013

pgr_quote_ident(text) will get pushed in a minute. I used this name instead of camelcase so it mirror the postgresql function.

@dkastl
Copy link
Member

dkastl commented May 16, 2013

Cool. Thanks!

@dkastl dkastl removed the 2.0 label Mar 23, 2015
rohithsankepally referenced this issue in rohithsankepally/pgrouting Jun 14, 2016
cvvergara pushed a commit that referenced this issue Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants