Re: [SQL] How to query by column names

2007-01-23 Thread John Summerfield

Jeff Frost wrote:

On Tue, 23 Jan 2007, Josh Williams wrote:


From: Jeff Frost <[EMAIL PROTECTED]>

On Mon, 22 Jan 2007, Richard Ray wrote:

...

That's definitely part of it.  I'm assuming the above is an abridged 
example and the OP is doing something dynamic with the query.  The 
real trouble is Bash likes to expand the asterisk into a list of every 
file in the current directory when you try to push the command through 
a variable.  So it's just a matter of finding a way to escape the * 


Oh, good grief Charlie Brown:

backslash it:
\*

so:
echo select \* from whatsit | psql test


character to keep Bash from globbing, which unfortunately right now is 
escaping me (no pun intended.)


--

Off-list replies unwelcome

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] How to query by column names

2007-01-23 Thread John Summerfield

John Summerfield wrote:

Jeff Frost wrote:

On Tue, 23 Jan 2007, Josh Williams wrote:


From: Jeff Frost <[EMAIL PROTECTED]>

On Mon, 22 Jan 2007, Richard Ray wrote:

...

That's definitely part of it.  I'm assuming the above is an abridged 
example and the OP is doing something dynamic with the query.  The 
real trouble is Bash likes to expand the asterisk into a list of 
every file in the current directory when you try to push the command 
through a variable.  So it's just a matter of finding a way to escape 
the * 


Oh, good grief Charlie Brown:

backslash it:
\*

so:
echo select \* from whatsit | psql test

Oh
echo select \* from whatsit \; | psql test





---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[SQL] Odbc configuration on Localhost

2007-01-23 Thread Ezequias Rodrigues da Rocha

Hi list,

Is there any tip to set a localhost connection on the windows odbc
configuration to postgresql ?

I am using 127.0.0.1 and localhost and notthing.

Any suggest ?

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Atenciosamente (Sincerely)
   Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/


Re: [SQL] Odbc configuration on Localhost

2007-01-23 Thread Oisin Glynn

Ezequias Rodrigues da Rocha wrote:

Hi list,

Is there any tip to set a localhost connection on the windows odbc 
configuration to postgresql ?


I am using 127.0.0.1  and localhost and notthing.

Any suggest ?

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Atenciosamente (Sincerely)
Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/  

Are you getting any errors?
What have you got set in your pg_hba.conf and postgresql.conf for access 
rights?


Oisin


--
Oisin Glynn My status 


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [SQL] select based on multi-column primary keys

2007-01-23 Thread codeWarrior
No...  its a table constraint using a unique, implicit index on the listed 
columns. .

PRIMARY KEY ( column [, ...] )

The PRIMARY KEY table constraint is similar to the PRIMARY KEY column 
constraint. As a table constraint, PRIMARY KEY allows multiple columns to be 
defined in a parenthetical expression, separated by commas. An implicit 
index will be created across columns. The combination of values for each 
column specified must therefore amount to only unique and non-NULL values, 
as with the PRIMARY KEY column constraint.



hehehe


"Andrew Sullivan" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Fri, Jan 19, 2007 at 07:45:40PM -0800, codeWarrior wrote:
>> AFAIK: You cannot have multiple primary keys. How would you know which 
>> one
>> is the actual key ?
>
> You can have a multi-column primary key, though.  That's a perfectly
> legitimate approach.
>
>> FYI: What you are really talking about are table contraints... When you 
>> have
>
> No, it's a multi-column primary key.
>
>> My advice would be to alter your table structure so that you have a 
>> "real"
>> PK not table constraints -- that would make it searchable
>
> This is already searchable.  What you are talking about is not a real
> primary key, but an artificial one.  The OP already has a real
> primary key.  SQL purists think artificial primary keys mean that you
> haven't done enough normalisation.  I'm going to remain silent on
> that topic, though, so that we don't get a Thread That Does Not End
> :)
>
> A
>
>
> -- 
> Andrew Sullivan  | [EMAIL PROTECTED]
> If they don't do anything, we don't need their acronym.
> --Josh Hamilton, on the US FEMA
>
> ---(end of broadcast)---
> TIP 1: if posting/reading through Usenet, please send an appropriate
>   subscribe-nomail command to [EMAIL PROTECTED] so that your
>   message can get through to the mailing list cleanly
> 



---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [SQL] select based on multi-column primary keys

2007-01-23 Thread Andrew Sullivan
On Tue, Jan 23, 2007 at 01:07:19PM -0800, codeWarrior wrote:
> No...  its a table constraint using a unique, implicit index on the listed 
> columns. .

Sure.  But since these get added as table constraints after dump
anyway, I'm not sure I see why it makes a difference.

In any case, the point is that what you call a "real" primary key is
an artificial one, and what SQL weenies would think is a "real"
primary key is in fact, a natural primary key based on the data in
the table.  That may well be multiple columns of data.  (I know of
one really nasty case where it was five.  Yes, the application needed
rewriting.  But it was normalised :)

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
A certain description of men are for getting out of debt, yet are
against all taxes for raising money to pay it off.
--Alexander Hamilton

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly