Re: [SQL] How can I read display message from a C function

2006-05-05 Thread Markus Schaber
Hi, Fay,

Fay Du wrote:

> I would like to put some message in my C function ( myTestFunction).
> Currently, I want to see time for each function call inside
> myTestFunction. The output to the screen commands are in myTestFunction.
> myTestFunction is called from postgresql. How can I see the messages?

Hmm, would statement logging help you?

If not, you could use elog(NOTICE, "message with time");

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

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


[SQL] Returning String as Integer

2006-05-05 Thread Kashmira Patel \(kupatel\)



Hi 
all,
   I have 
a table with a column of type 'text'. It mainly contains numbers. Is there any 
way to select a value from this column and return it as an 
integer?
 
Thanks,
Kashmira


Re: [SQL] Returning String as Integer

2006-05-05 Thread Jorge Godoy
Em Sexta 05 Maio 2006 18:37, Kashmira Patel (kupatel) escreveu:
> Hi all,
>I have a table with a column of type 'text'. It mainly contains
> numbers. Is there any way to select a value from this column and return
> it as an integer?

testing=# select '123'::integer;
 int4 
--
  123
(1 registro)

testing=# 


-- 
Jorge Godoy  <[EMAIL PROTECTED]>


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


Re: [SQL] Returning String as Integer

2006-05-05 Thread elein
Use the to_number() function to convert text to numbers.
In the manual under functions and operators.  The other
function like it is to_date().

--elein
[EMAIL PROTECTED]

On Fri, May 05, 2006 at 02:37:13PM -0700, Kashmira Patel (kupatel) wrote:
> Hi all,
>I have a table with a column of type 'text'. It mainly contains numbers. Is
> there any way to select a value from this column and return it as an integer?
>  
> Thanks,
> Kashmira

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


Re: [SQL] Returning String as Integer

2006-05-05 Thread Hogan, James F. Jr.
Here is a Perl function a friend of mine wrote to help with this...

Problems I ran into were errors because of NON NUMERIC Characters in the
String...

Casting would fail

It doesn't catch all cases but it has been quite helpful to me


$x = $_[0];
$x =~ s/^[^-\d\.]*//;
$x =~ s/\,//g;
$x = $x * 1;
return $x;


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jorge Godoy
Sent: Friday, May 05, 2006 4:52 PM
To: [email protected]
Subject: Re: [SQL] Returning String as Integer

Em Sexta 05 Maio 2006 18:37, Kashmira Patel (kupatel) escreveu:
> Hi all,
>I have a table with a column of type 'text'. It mainly contains
> numbers. Is there any way to select a value from this column and
return
> it as an integer?

testing=# select '123'::integer;
 int4 
--
  123
(1 registro)

testing=# 


-- 
Jorge Godoy  <[EMAIL PROTECTED]>


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

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


Re: [SQL] Returning String as Integer

2006-05-05 Thread Kashmira Patel (kupatel)
Thanks everyone :)  

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jorge Godoy
Sent: Friday, May 05, 2006 2:52 PM
To: [email protected]
Subject: Re: [SQL] Returning String as Integer

Em Sexta 05 Maio 2006 18:37, Kashmira Patel (kupatel) escreveu:
> Hi all,
>I have a table with a column of type 'text'. It mainly contains 
> numbers. Is there any way to select a value from this column and 
> return it as an integer?

testing=# select '123'::integer;
 int4
--
  123
(1 registro)

testing=# 


-- 
Jorge Godoy  <[EMAIL PROTECTED]>


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

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