Re: [GENERAL] Custom column ordering

2016-03-07 Thread Steven Xu
I see. Thanks again! I removed the "port" data type from my implementation and just used the ORDER BY... USING clause and the explain output/results is providing what I expect.StevenThat is an editing mistake.  I mean> hasegeli=# SELECT port FROM device_port ORDER BY cast_to_port(port);

Re: [GENERAL] Custom column ordering

2016-03-07 Thread Emre Hasegeli
> Although, I do find your output very strange. You wrote ORDER BY port, which > is a text type. Why does Postgres order using the ordering operators of the > "Port" data type rather than the "text" type, even though you haven't > performed a cast? That is an editing mistake. I mean > hasegeli=#

Re: [GENERAL] Custom column ordering

2016-03-07 Thread Steven Xu
rather than the "text" type, even though you haven't performed a cast?Steven-Emre Hasegeli wrote: -To: Steven Xu From: Emre Hasegeli Date: 03/05/2016 09:30AMCc: "pgsql-general@postgresql.org" Subject: Re: [GENERAL] Custom column ordering>   - Why is PostgreSQL n

Re: [GENERAL] Custom column ordering

2016-03-05 Thread Emre Hasegeli
> - Why is PostgreSQL not using the functional index I created and why is it > not being ordered correctly? Your example works for me: > hasegeli=# CREATE TABLE device_port (port text); > CREATE TABLE > > hasegeli=# CREATE INDEX idx_device_port_port_proper ON device_port > (cast_to_port(port)

[GENERAL] Custom column ordering

2016-03-01 Thread Steven Xu
Hi all,I'm trying to order some rows based on port names, a text column, using some domain-specific knowledge for Netdisco, an open-source application. In particular, I'm trying to do this without having to redo the entire design for the database. Note that in this database, there are no foreign ke