I have a table with these columns:
id, node, parent_node_id
The top-most nodes would have a parent_node_id of
NULL. Is it possible to get a node, and all its parent
nodes, in a single query?
For example, a node might be:
books > computers > databases > oss > postgres
and the rows fetched would
Couple of ways to do it. One is to use the hierarchical query patch
that mimics Oracle's CONNECT BY
syntax at
http://www.brasileiro.net/postgres/cookbook/view-one-recipe.adp?
recipe_id=19490.
Another way is to use a nested set model, described at
http://www.geocrawler.com/archives/3/6/2001/
Hi all,
Using postgres 8.4.13 (latest that redhat provides in rhel6) the query
below returns an extra row compared to running the same thing in later
versions (tried 9.0, 9.1, 9.2 - they don't return the extra row).
Just wondering if anyone had thoughts on why, and/or how to remove the
dupli
chris smith-9 wrote
> Hi all,
>
> Using postgres 8.4.13 (latest that redhat provides in rhel6) the query
> below returns an extra row compared to running the same thing in later
> versions (tried 9.0, 9.1, 9.2 - they don't return the extra row).
>
>
> SELECT *
> FROM numbers
> ORDER BY iterati
David Johnston writes:
> chris smith-9 wrote
>> Using postgres 8.4.13 (latest that redhat provides in rhel6) the query
>> below returns an extra row compared to running the same thing in later
>> versions (tried 9.0, 9.1, 9.2 - they don't return the extra row).
> Likely this is a bug that was f
On 16/10/13 01:56, Tom Lane wrote:
David Johnston writes:
chris smith-9 wrote
Using postgres 8.4.13 (latest that redhat provides in rhel6) the query
below returns an extra row compared to running the same thing in later
versions (tried 9.0, 9.1, 9.2 - they don't return the extra row).
Likel
There are over 20 million records in a self-referential database table, where
one record may point to another record as a descendant.
Because of a bug in application code, there was no limit on recursion. The max
was supposed to be 4. A few outlier records have between 5 and 5000
descendants
On Thu, Jan 26, 2017 at 4:37 PM, Jonathan Vanasco wrote:
> There are over 20 million records in a self-referential database table,
> where one record may point to another record as a descendant.
>
> Because of a bug in application code, there was no limit on recursion.
> The max was supposed to b
On Jan 26, 2017, at 7:07 PM, David G. Johnston wrote:
> Thinking aloud - why doesn't just finding every record with 5 descendants
> not work? Any chain longer than 5 would have at least 5 items.
Oh it works. This is why I ask these questions -- new perspectives!
> Even without recursion you