Обсуждение: Simple question about messages

Поиск
Список
Период
Сортировка

Simple question about messages

От
Hadley Willan
Дата:
Hi All,
   I've written a script that trawls through my sql code and in
conjunction with GPP parses my code. I can then pipe this output from
bash to a file and as one large file, pipe that sql into postgresql from
the cli psql.

eg.
psql -h gaia -U postgres -d template1 < create_users_and_database.sql >
dbout.txt

That way the output is put into a file rather than just the terminal.
It also reduces the clutter on the screen and off the mark I get the
table create notice like NOTICE:: CREATE TABLE ......

However, may question is that how do I raise custom notices like 'At
point x' or something. That way I can get a feel for where the commands
are and that way when the occasiconal 'parser: parse error at or near
'WHERE' character 2' pops up know where roughly to find it.

I've tried RAISE NOTICE 'xxx'; but that fails.
SELECT 'point x' AS point; creates a larger output of result name and
text, but that isn't ideal.

I've flicked through the docs, but nothing jumps out at me?

Thanks.
--
Hadley Willan > Systems Development > Deeper Design Limited. +64(7)377-3328
hadley.willan@deeperdesign.co.nz > www.deeperdesign.com > +64(21)-28-41-463
Level 1, 4 Tamamutu St, PO Box 90, TAUPO 2730, New Zealand.


Re: Simple question about messages

От
Tom Lane
Дата:
Hadley Willan <hadley.willan@deeperdesign.co.nz> writes:
> However, may question is that how do I raise custom notices like 'At
> point x' or something.

psql's \echo command might fit the bill.

            regards, tom lane


Re: Simple question about messages

От
Hadley Willan
Дата:
Hmm, no luck. Seems that the echo command is routed out to the output
file. Which is kinda expected. I was kinda hoping that it would be like
the Create Table notices which appear in the terminal.

Hadley.

On Wed, 2003-04-30 at 10:52, Tom Lane wrote:
> Hadley Willan <hadley.willan@deeperdesign.co.nz> writes:
> > However, may question is that how do I raise custom notices like 'At
> > point x' or something.
>
> psql's \echo command might fit the bill.
>
>             regards, tom lane
--
Hadley Willan > Systems Development > Deeper Design Limited. +64(7)377-3328
hadley.willan@deeperdesign.co.nz > www.deeperdesign.com > +64(21)-28-41-463
Level 1, 4 Tamamutu St, PO Box 90, TAUPO 2730, New Zealand.


Re: Simple question about messages

От
Martijn van Oosterhout
Дата:
On Wed, Apr 30, 2003 at 11:31:56AM +1200, Hadley Willan wrote:
> Hmm, no luck. Seems that the echo command is routed out to the output
> file. Which is kinda expected. I was kinda hoping that it would be like
> the Create Table notices which appear in the terminal.

Something I have had luck with sometimes (though sometimes it confuses psql)
is to do:

\!echo hello >&2

Sometimes psql tries to treat it as SQL though. Maybe it's worth a try?

> On Wed, 2003-04-30 at 10:52, Tom Lane wrote:
> > Hadley Willan <hadley.willan@deeperdesign.co.nz> writes:
> > > However, may question is that how do I raise custom notices like 'At
> > > point x' or something.
> >
> > psql's \echo command might fit the bill.
> >
> >             regards, tom lane
> --
> Hadley Willan > Systems Development > Deeper Design Limited. +64(7)377-3328
> hadley.willan@deeperdesign.co.nz > www.deeperdesign.com > +64(21)-28-41-463
> Level 1, 4 Tamamutu St, PO Box 90, TAUPO 2730, New Zealand.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
>   - Samuel P. Huntington

Вложения