Re: Two columns with same name in subselect--any way to SELECT without *?

2018-01-06 Thread David G. Johnston
On Saturday, January 6, 2018, Ken Tanzer wrote: > > So having thought about this a little more, it seems like once you create > a result set with identically-named columns, those columns are effectively > crippled. In that they can be viewed (via SELECT *), but not referenced, > used or acted upo

Re: Two columns with same name in subselect--any way to SELECT without *?

2018-01-06 Thread Ken Tanzer
On Sat, Jan 6, 2018 at 9:16 PM, Ken Tanzer wrote: > > > On Sat, Jan 6, 2018 at 9:10 PM, Adrian Klaver > wrote: > >> On 01/06/2018 08:46 PM, Ken Tanzer wrote: >> >>> Hi. You can have multiple columns with the same name, and use it as a >>> subselect, like this silly example: >>> >>> SELECT 'a' A

Re: Two columns with same name in subselect--any way to SELECT without *?

2018-01-06 Thread Ken Tanzer
On Sat, Jan 6, 2018 at 9:10 PM, Adrian Klaver wrote: > On 01/06/2018 08:46 PM, Ken Tanzer wrote: > >> Hi. You can have multiple columns with the same name, and use it as a >> subselect, like this silly example: >> >> SELECT 'a' AS my_col,'b' AS my_col,'foo' AS other; >> SELECT * FROM (SELECT 'a'

Re: Two columns with same name in subselect--any way to SELECT without *?

2018-01-06 Thread Adrian Klaver
On 01/06/2018 08:46 PM, Ken Tanzer wrote: Hi.  You can have multiple columns with the same name, and use it as a subselect, like this silly example: SELECT 'a' AS my_col,'b' AS my_col,'foo' AS other; SELECT * FROM (SELECT 'a' AS my_col,'b' AS my_col,'foo' AS other) foo; But is there any way to

Two columns with same name in subselect--any way to SELECT without *?

2018-01-06 Thread Ken Tanzer
Hi. You can have multiple columns with the same name, and use it as a subselect, like this silly example: SELECT 'a' AS my_col,'b' AS my_col,'foo' AS other; SELECT * FROM (SELECT 'a' AS my_col,'b' AS my_col,'foo' AS other) foo; But is there any way to select either of those columns without takin

Re: What generates pg_config.h?

2018-01-06 Thread Travis Allison
I wanted to thank all of you for solving my problem. You have all been unbelievably helpful! Travis On Sat, Jan 6, 2018 at 7:42 AM, Christoph Berg wrote: > Re: Adrian Klaver 2018-01-06 <67591f85-a910-2e0b-1fdd- > 9c774eacd...@aklaver.com> > > The problem you are running into is that the build

Re: Ideas to deal with table corruption

2018-01-06 Thread Rui DeSousa
Correct, and there is no need to create an index on a unique constraint or primary key as they are already implemented via indexes. I can’t count how many duplicate indexes I’ve dropped in the past. I use this view help find duplicates in a given system. Duplicate indexes just use up space an

Re: Ideas to deal with table corruption

2018-01-06 Thread scott ribe
On Jan 6, 2018, at 12:11 PM, Corey Taylor wrote: > Is it possible for an index to not exist on those columns? > > https://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-FK > > "A foreign key must reference columns that either are a primary key or form a > unique con

Re: Ideas to deal with table corruption

2018-01-06 Thread Corey Taylor
On Sat, Jan 6, 2018 at 12:30 PM, Melvin Davidson wrote: > > *Don't forget to create indexes on the FK's in the table they reference!* > > > *Also, it would be nice to know the PostgreSQL version and O/S.* > Is it possible for an index to not exist on those columns? https://www.postgresql.org/d

Re: Ideas to deal with table corruption

2018-01-06 Thread Melvin Davidson
On Sat, Jan 6, 2018 at 1:23 PM, Peter Geoghegan wrote: > On Sat, Jan 6, 2018 at 2:11 AM, Luis Marin > wrote: > > I am looking for ideas, to help me, check what is happening with a > possible > > table corruption, I have some FK that works ok, but some stay in the > state > > waiting forever, ho

Re: Ideas to deal with table corruption

2018-01-06 Thread Peter Geoghegan
On Sat, Jan 6, 2018 at 2:11 AM, Luis Marin wrote: > I am looking for ideas, to help me, check what is happening with a possible > table corruption, I have some FK that works ok, but some stay in the state > waiting forever, however selecting the same table works fine. > > Since, I am a newbie, in

Re: Ideas to deal with table corruption

2018-01-06 Thread Rui DeSousa
How large are the given tables and is the databases in heavy use at the time? It sounds like either blocking is occurring or you’re dealing with large tables and the validation is take a long time; which, in both case is normal. Try creating the foreign key without validation, i.e. use the “not

Re: Ideas to deal with table corruption

2018-01-06 Thread Adrian Klaver
On 01/06/2018 02:11 AM, Luis Marin wrote: Dear community, I am looking for ideas, to help me, check what is happening with a possible  table corruption, I  have some FK that works ok, but some stay in the state waiting forever, however selecting the same table works fine. From further comme

Re: What generates pg_config.h?

2018-01-06 Thread Christoph Berg
Re: Adrian Klaver 2018-01-06 <67591f85-a910-2e0b-1fdd-9c774eacd...@aklaver.com> > The problem you are running into is that the build process is using both the > older(9.6.5) and newer(10.0) pg_config.h at the same time. Fwiw, all issues I've seen so far of that kind could be resolved by putting -I

Re: What generates pg_config.h?

2018-01-06 Thread Adrian Klaver
On 01/05/2018 09:36 PM, Travis Allison wrote: Tom, I guess I don't understand the point of having a different pg_config.h in my user/include/postgresql directory than the postgresql server that I am running.  You mentioned building client code that would reference the pg_config.h in user/includ

Ideas to deal with table corruption

2018-01-06 Thread Luis Marin
Dear community, I am looking for ideas, to help me, check what is happening with a possible table corruption, I have some FK that works ok, but some stay in the state waiting forever, however selecting the same table works fine. Since, I am a newbie, in PostgreSQL, what should be my firsts step