<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Hi all,</div><div>I have one question.</div><div>I wrote this query in my java code:</div><div>"CREATE table many_line AS SELECT ST_AsText(St_makeline(sp, ep)) as line, gmlid, parent_id, root_id from (select st_pointN(geom, generate_series(1, ST_NPoints(geom)-1)) as sp, ST_PointN(geom, generate_series(2, ST_NPoints(geom)  )) as ep, gmlid, parent_id, root_id FROM (SELECT (ST_Dump(ST_Boundary(geometry))).geom, g.gmlid, g.parent_id, g.root_id FROM surface_geometry g where (g.parent_id=15) ) AS linestrings ) AS segments"; It works perfectly but my problem is that I need also to have a unique id for each line in the created table. How can I include the column of line ids to this table?</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent;
 font-style: normal;">For more clarity I put my code here as well:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">public static void linstring(String url, String username, String password){<br>         Connection con = null;<br>            Statement st = null;<br>            ResultSet rs = null;<br>            <br>            String Query ="CREATE table many_line AS SELECT ST_AsText(St_makeline(sp, ep)) as line, gmlid, parent_id, root_id from (select st_pointN(geom, generate_series(1,
 ST_NPoints(geom)-1)) as sp, ST_PointN(geom, generate_series(2, ST_NPoints(geom)  )) as ep, gmlid, parent_id, root_id FROM (SELECT (ST_Dump(ST_Boundary(geometry))).geom, g.gmlid, g.parent_id, g.root_id FROM surface_geometry g where (g.parent_id=15) ) AS linestrings ) AS segments";<br>            <br>            <br>            try{<br>                <br>                Class.forName("org.postgresql.Driver");<br>                con = DriverManager.getConnection(url, username, password);<br>                st= con.createStatement();<br>       
         rs=st.executeQuery(Query);<br>                <br>                while(rs.next()){<br>                    System.out.println(rs.getString(1)+"/");<br>                    System.out.println(rs.getString(2)+"/");<br>                    System.out.print(rs.getInt(3)+"/");<br>                    System.out.println(rs.getInt(4)+"/");<br>                }<br>               
 <br>            }catch (SQLException ex) {<br>                Logger lgr = Logger.getLogger(database.class.getName());<br>                lgr.log(Level.SEVERE, ex.getMessage(), ex);<br><br>        } catch (ClassNotFoundException e) {<br>                e.printStackTrace();<br>                }<br>        <br>        finally {<br><br>                try {<br>                    if (rs != null)
 {<br>                        rs.close();<br>                    }<br>                    if (st != null) {<br>                        st.close();<br>                    }<br>                    if (con != null) {<br>                        con.close();<br>   
                 }<br><br>                } catch (SQLException ex) {<br>                    Logger lgr = Logger.getLogger(database.class.getName());<br>                    lgr.log(Level.WARNING, ex.getMessage(), ex);<br>                }<br>            }<br>            <br>    }<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div
 style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div></div></body></html>