Thread: psql commandline
Hi list the following commandline query doesn`t work..... su - postgres -c 'psql --dbname database --command "UPDATE users SET pin=12345 WHERE login='admin';"' Any idea why? please help... -- GMX DSL = Maximale Leistung zum minimalen Preis! 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
On Wednesday 31 Aug 2005 6:00 pm, dIGITx wrote: > su - postgres -c 'psql --dbname database --command "UPDATE users > SET pin=12345 WHERE login='admin';"' works for me - what is the error you are getting? -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.in ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!
The error is : column "admin" doesn`t exist What the f... is that db doing? > --- Ursprüngliche Nachricht --- > Von: Kenneth Gonsalves <lawgon@thenilgiris.com> > An: pgsql-sql@postgresql.org > Betreff: Re: [SQL] psql commandline > Datum: Wed, 31 Aug 2005 18:13:18 +0530 > > On Wednesday 31 Aug 2005 6:00 pm, dIGITx wrote: > > su - postgres -c 'psql --dbname database --command "UPDATE users > > SET pin=12345 WHERE login='admin';"' > > works for me - what is the error you are getting? > > -- > regards > kg > > http://www.livejournal.com/users/lawgon > tally ho! http://avsap.org.in > à²à²à²¡à³à²²à²¿à²¨à²à³à²¸ வாழà¯à®! > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse für Mail, Message, More +++
On Wednesday 31 Aug 2005 6:24 pm, digit-x@gmx.net wrote: > The error is : > > column "admin" doesn`t exist try \'admin\' -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.in ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!
Thx, but already did that. After entering the statement that way my console hangs and only ctrl-d gets it working again. error shown than is: unexpected EOF while looking for matchin '"' bash: syntax error: unexpected end of file > --- Ursprüngliche Nachricht --- > Von: Kenneth Gonsalves <lawgon@thenilgiris.com> > An: pgsql-sql@postgresql.org > Betreff: Re: [SQL] psql commandline > Datum: Wed, 31 Aug 2005 18:33:57 +0530 > > On Wednesday 31 Aug 2005 6:24 pm, digit-x@gmx.net wrote: > > The error is : > > > > column "admin" doesn`t exist > > try \'admin\' > -- > regards > kg > > http://www.livejournal.com/users/lawgon > tally ho! http://avsap.org.in > à²à²à²¡à³à²²à²¿à²¨à²à³à²¸ வாழà¯à®! > > ---------------------------(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 -- Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko! Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
Be quiet... it is not a db problem: your shell interprets "'" characters before sending them to psql so your query becomes UPDATE users SET pin=12345 WHERE login=admin; and column admin (not the literal 'admin') doesn't really exist! Try this: su - postgres -c "psql --dbname database --command \"UPDATE users SET pin=12345 WHERE login='admin';\"" > The error is : > > column "admin" doesn`t exist > > What the f... is that db doing? > > > >>--- Ursprüngliche Nachricht --- >>Von: Kenneth Gonsalves <lawgon@thenilgiris.com> >>An: pgsql-sql@postgresql.org >>Betreff: Re: [SQL] psql commandline >>Datum: Wed, 31 Aug 2005 18:13:18 +0530 >> >>On Wednesday 31 Aug 2005 6:00 pm, dIGITx wrote: >> >>>su - postgres -c 'psql --dbname database --command "UPDATE users >>>SET pin=12345 WHERE login='admin';"' >> >>works for me - what is the error you are getting? >> >>-- >>regards >>kg >> >>http://www.livejournal.com/users/lawgon >>tally ho! http://avsap.org.in >>ಇಂಡà³�ಲಿನಕà³�ಸ வாழà¯�க! >> >>---------------------------(end of broadcast)--------------------------- >>TIP 6: explain analyze is your friend > >
On Wednesday 31 Aug 2005 6:49 pm, Zac wrote: > su - postgres -c "psql --dbname database --command \"UPDATE users > SET pin=12345 WHERE login='admin';\"" works - good thing to know -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.in ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!
On Wednesday 31 Aug 2005 6:43 pm, digit-x@gmx.net wrote: > After entering the statement that way my console hangs and only > ctrl-d gets it working again. the problem is that the quotes round 'admin' are needed to tell psql that this is a value - but i have no idea how to create the quotes on the command line -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.in ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!