X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C5422D1E138 for ; Fri, 20 Feb 2004 14:26:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 91366-03 for ; Fri, 20 Feb 2004 10:26:06 -0400 (AST) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 36926D1E0EF for ; Fri, 20 Feb 2004 10:25:59 -0400 (AST) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id i1KEP3Nu007176; Fri, 20 Feb 2004 16:25:03 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id i1KEOrEl007168; Fri, 20 Feb 2004 16:25:00 +0200 Date: Fri, 20 Feb 2004 16:24:53 +0200 (EET) From: Achilleus Mantzios To: mark Cc: pgsql-sql@postgresql.org Subject: Re: create function atof? In-Reply-To: <200402200904.11199.postgresql@novacolor.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/304 X-Sequence-Number: 16994 O kyrios mark egrapse stis Feb 20, 2004 : > Hello, > > Is it possible to create a database function that mimics the C function atof? > I'm guessing it should look something like this: > > create function atof(varchar) returns float > as '??????' > language ???? > returns null on null input; Simply use # select ''::text::float4; or create function atof(varchar) returns float language sql as 'select $1::text::float' returns null on null input; > > Thanks, > > Mark > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -- -Achilleus