Обсуждение: Formatting psql output
I'm sure I'm missing something obvious here, but how can I tell either the server or psql to limit the number of digits presented in a set of results? Is there a facility somewhere for applying something like a printf format string? -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
DEBUG: recycled transaction log file 0000000000000018 DEBUG: ServerLoop: select failed: Permission denied PGSTATBUFF: select(2)Permission denied : Permission denied i have got this why i have got this error?
Hi , I would like to know how to cast as numeric.For examlple I can use cast as cast(to_number(substring(os_crm_exchange_call_id, 4), 999999999999) as smallint) but here I will have the restriction of the field so If I want to cast it as numeric how do I do that. -- Best Regards - Savita ---------------------------------------------------- Hewlett Packard (India) +91 80 2051288 (Phone) 847 1288 (HP Telnet) ----------------------------------------------------
markMLl.pgsql-general@telemetry.co.uk wrote: > I'm sure I'm missing something obvious here, but how can I tell either > the server or psql to limit the number of digits presented in a set of > results? Is there a facility somewhere for applying something like a > printf format string? We will implement that in 7.4. Not done yet. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> markMLl.pgsql-general@telemetry.co.uk wrote:
>> I'm sure I'm missing something obvious here, but how can I tell either
>> the server or psql to limit the number of digits presented in a set of
>> results? Is there a facility somewhere for applying something like a
>> printf format string?
> We will implement that in 7.4. Not done yet.
There's always to_char() ...
regards, tom lane
Thanks everybody. It's not urgent (the normal apps are doing their own thing and I only use psql for maintenance) so for heavens sake /don't/ let it detract from the effort going into replication <grin>. Tom Lane wrote: > > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > markMLl.pgsql-general@telemetry.co.uk wrote: > >> I'm sure I'm missing something obvious here, but how can I tell either > >> the server or psql to limit the number of digits presented in a set of > >> results? Is there a facility somewhere for applying something like a > >> printf format string? > > > We will implement that in 7.4. Not done yet. > > There's always to_char() ... -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
On Wed, Nov 06, 2002 at 10:47:59 +0000, markMLl.pgsql-general@telemetry.co.uk wrote: > I'm sure I'm missing something obvious here, but how can I tell either > the server or psql to limit the number of digits presented in a set of > results? Is there a facility somewhere for applying something like a > printf format string? The to_char function can do this.
On Wed, Nov 06, 2002 at 18:21:08 +0530, Savita <savita@india.hp.com> wrote: > Hi , > > I would like to know how to cast as numeric.For examlple > > I can use cast as > > cast(to_number(substring(os_crm_exchange_call_id, 4), 999999999999) as > smallint) ::numeric numeric has 2 option paramters that allow you to limit the precision and specify a scale. The default is to not limit precision.
On Wed, 6 Nov 2002, Florian Litot wrote: > DEBUG: recycled transaction log file 0000000000000018 > DEBUG: ServerLoop: select failed: Permission denied > PGSTATBUFF: select(2)Permission denied > : Permission denied It sounds like the ownership of the files is wrong. Do the files in $PGDATGA/pg_xlog belong to the postgres super user? Does the directory?
Hi all,
I'm trying to find a function that will replace one word with another in a
string.
e.g. select <replace function>('bob was here, bobina wasnt', 'bob', 'mike');
will return "mike was here, mikeina wasnt"
Is there such a function already written in PostGreSQL?
Thanks in advance,
Mark
Mark Wilson wrote:
> Hi all,
>
> I'm trying to find a function that will replace one word with another in a
> string.
>
> e.g. select <replace function>('bob was here, bobina wasnt', 'bob', 'mike');
> will return "mike was here, mikeina wasnt"
>
> Is there such a function already written in PostGreSQL?
>
It is new in 7.3 (currently in beta). See the function called "replace" at:
http://developer.postgresql.org/docs/postgres/functions-string.html
test=# select replace('bob was here, bobina wasnt', 'bob', 'mike');
replace
------------------------------
mike was here, mikeina wasnt
(1 row)
HTH,
Joe
There is a function called TRANSLATE
This will do the trick
HTH
On Thu, 7 Nov 2002, Mark Wilson wrote:
> Hi all,
>
> I'm trying to find a function that will replace one word with another in a
> string.
>
> e.g. select <replace function>('bob was here, bobina wasnt', 'bob', 'mike');
> will return "mike was here, mikeina wasnt"
>
> Is there such a function already written in PostGreSQL?
>
> Thanks in advance,
> Mark
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
--
Darren Ferguson
Darren Ferguson wrote:
> There is a function called TRANSLATE
>
> This will do the trick
>
> HTH
TRANSLATE performs a character-by-character replacement. You
cannot use TRANSLATE to substitute words or phrases. Example:
SELECT TRANSLATE('mikei', 'ike', '*8p');
m*8p*
all i's->*
all k's->8
all e's->p
You must either write your own replace(), or use the one
included in 7.3 as Joe Conway mentioned.
Mike Mascari
mascarm@mascari.com
>
> On Thu, 7 Nov 2002, Mark Wilson wrote:
>
>>Hi all,
>>
>>I'm trying to find a function that will replace one word with another in a
>>string.
>>
>>e.g. select <replace function>('bob was here, bobina wasnt', 'bob', 'mike');
>>will return "mike was here, mikeina wasnt"
>>
>>Is there such a function already written in PostGreSQL?
Must be a slow posting day today :~)
Thanks everyone. I'm running PostGreSQL 7.2.1 and have run in the replace
function that numerous people sent me. It works exactly as I would expect
it to.
Cheers,
Mark
----- Original Message -----
From: "Joe Conway" <mail@joeconway.com>
To: "Mark Wilson" <mark@mediasculpt.com>
Cc: <pgsql-general@postgresql.org>
Sent: Thursday, November 07, 2002 11:51 AM
Subject: Re: [GENERAL] replace text function
> Mark Wilson wrote:
> > Hi all,
> >
> > I'm trying to find a function that will replace one word with another in
a
> > string.
> >
> > e.g. select <replace function>('bob was here, bobina wasnt', 'bob',
'mike');
> > will return "mike was here, mikeina wasnt"
> >
> > Is there such a function already written in PostGreSQL?
> >
>
> It is new in 7.3 (currently in beta). See the function called "replace"
at:
> http://developer.postgresql.org/docs/postgres/functions-string.html
>
> test=# select replace('bob was here, bobina wasnt', 'bob', 'mike');
> replace
> ------------------------------
> mike was here, mikeina wasnt
> (1 row)
>
>
> HTH,
>
> Joe
>
>
>
how i can configure postgre to ahve the maximum of trace?
I know you're sorted with a solution, but the responses must have been off-list. For the record, and to point others to useful additional functionality the PostgreSQL Cookbook is always useful and has a REPLACE function: http://www.brasileiro.net/postgres/cookbook/ http://www.brasileiro.net:8080/postgres/cookbook/view-one-recipe.adp?recipe_id=8886 Lee. Mark Wilson writes: > Must be a slow posting day today :~) > > Thanks everyone. I'm running PostGreSQL 7.2.1 and have run in the replace > function that numerous people sent me. It works exactly as I would expect > it to. > > > Mark Wilson wrote: > > > Hi all, > > > > > > I'm trying to find a function that will replace one word with another in > a > > > string. > > > > > > e.g. select <replace function>('bob was here, bobina wasnt', 'bob', > 'mike'); > > > will return "mike was here, mikeina wasnt" > > > > > > Is there such a function already written in PostGreSQL? > > >