HI All,
I have a database column which type is bytea. It contains floats converted
as byte array (4 bytes per one float) and encoding is Escape. I would be
able to get corresponding bytea string using substring function.
My question is how can I convert bytea string to float inside a SQL
function
Jasen Betts wrote:
> On 2010-05-26, Gerardo Herzig wrote:
>> Hi all. Im not being able to cast a record variable into an array.
>>
>> Im writing a trigger, and i would like to store NEW (and OLD) as text[].
>> There is a way to do it in plpgsql? (w/o any contrib modules)
>
> why not store them as
On 2010-05-26, Gerardo Herzig wrote:
> Hi all. Im not being able to cast a record variable into an array.
>
> Im writing a trigger, and i would like to store NEW (and OLD) as text[].
> There is a way to do it in plpgsql? (w/o any contrib modules)
why not store them as text instead?
new::text
Hi all. Im not being able to cast a record variable into an array.
Im writing a trigger, and i would like to store NEW (and OLD) as text[].
There is a way to do it in plpgsql? (w/o any contrib modules)
thanks!
Gerardo
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes
On 2009-03-23, Zdravko Balorda wrote:
>
> Hi,
> I need a casting operator from boolean to integer,
you can use any expression
> tu put in ALTER TABLE statment after USING.
>
> Any ideas? Thanks.
CASE WHEN columname THEN 1 WHEN NOT columname THEN 0 ELSE NULL END
--
Sent via pgsql-sql m
CASE WHEN column='t' THEN 1 ELSE 0 END
Or just CASE WHEN column THEN 1 ELSE 0 END.
In the mean time I've got an elegant solution:
alter ... ... column TYPE smallint USING column::boolean::int::smallint;
It works, you wouldn't beleive it. ;)
Zdravko
--
Sent via pgsql-sql mailing list (pgsq
This:
SELECT true::integer, false::integer
also works on 8.1
--
regards
mk
2009/3/23 Achilleas Mantzios
> Στις Monday 23 March 2009 09:59:12 ο/η Zdravko Balorda έγραψε:
> >
> > Hi,
> > I need a casting operator from boolean to integer,
> > tu put in ALTER TABLE statment after USING.
> >
>
> S
On Mon, Mar 23, 2009 at 10:18:31AM +0200, Achilleas Mantzios wrote:
> Στις Monday 23 March 2009 09:59:12 ο/η Zdravko Balorda έγραψε:
> >
> > Hi,
> > I need a casting operator from boolean to integer,
> > tu put in ALTER TABLE statment after USING.
> >
>
> Sorry in the above email i meant smth li
Στις Monday 23 March 2009 09:59:12 ο/η Zdravko Balorda έγραψε:
>
> Hi,
> I need a casting operator from boolean to integer,
> tu put in ALTER TABLE statment after USING.
>
Sorry in the above email i meant smth like
CASE WHEN column='t' THEN 1 ELSE 0 END
however
SELECT 't'::boolean::int;
int4
-
Στις Monday 23 March 2009 09:59:12 ο/η Zdravko Balorda έγραψε:
>
> Hi,
> I need a casting operator from boolean to integer,
> tu put in ALTER TABLE statment after USING.
>
How about
CASE WHEN 't' THEN 1 ELSE 0 END
> Any ideas? Thanks.
>
> Zdravko
>
>
--
Achilleas Mantzios
--
Sent via p
Hi,
I need a casting operator from boolean to integer,
tu put in ALTER TABLE statment after USING.
Any ideas? Thanks.
Zdravko
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
Franklin Haut <[EMAIL PROTECTED]> writes:
> I Tries create a cast but the function text doesn't exist more in PG 8.3
sql-createcast.html tells that
"It is normally not necessary to create casts between user-defined
types and the standard string types (text, varchar, and
char(n)). PostgreSQ
Franklin Haut <[EMAIL PROTECTED]> writes:
> Create Table temp (id int4);
> insert into temp values (1215);
> insert into temp values (1216);
> insert into temp values (1217);
> insert into temp values (1218);
> insert into temp values (1219);
> insert into temp values (1220);
> insert into temp val
2008/2/6, Jaime Casanova <[EMAIL PROTECTED]>:
> did you read the release notes?
Obviously he did:
> I Know that changing the SQL command to :
> SELECT * FROM TEMP WHERE CAST(id AS TEXT) ilike ('%122%');
> work´s but for now isn't possible... :(
>
>
> I Tries create a cast but the function text
@postgresql.org
Subject: Re: [SQL] Cast in PG 8.3
On Feb 5, 2008 2:39 PM, Li, Jingfa <[EMAIL PROTECTED]> wrote:
> check the typo -- "ilike"
>
that's not a typo, it's "case insensitive LIKE"
--
regards,
Jaime Casanova
"Programming today is a race
On Feb 5, 2008 2:39 PM, Li, Jingfa <[EMAIL PROTECTED]> wrote:
> check the typo -- "ilike"
>
that's not a typo, it's "case insensitive LIKE"
--
regards,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the univers
check the typo -- "ilike"
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jaime Casanova
Sent: Tuesday, February 05, 2008 11:19 AM
To: Franklin Haut
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Cast in PG 8.3
On Feb 5, 2008 2:22 PM, Fra
On Feb 5, 2008 2:22 PM, Franklin Haut <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> I´m testing the new version of PostgreSQL in windows plataform but i have a
> problem.
>
>
> In PG 8.2
>
> Create Table temp (id int4);
> insert into temp values (1215);
> insert into temp values (1216);
> insert int
Hi all,
I´m testing the new version of PostgreSQL in windows plataform but i
have a problem.
In PG 8.2
Create Table temp (id int4);
insert into temp values (1215);
insert into temp values (1216);
insert into temp values (1217);
insert into temp values (1218);
insert into temp values (1
Richard Broersma Jr <[EMAIL PROTECTED]> writes:
> --- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
>> But when I open a query tool window and do:
>> SELECT * FROM view1;
>> Now, again type1 column returns as bpchar.
> This might be a good question to ask on the PGAdmin mailing list or even try
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
> Ugh, I'm totally crazy with this views
> I'm using pgadmin with postgres, when I clink on "view the data of
> selected object" button all works fine.
> But when I open a query tool window and do:
>
> SELECT * FROM view1;
> Now, again type1 co
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
> When I drop the view first , and then create again the view (in a
> separated transaction), now the command works! (this is a bug?)
Well according to the manual, it is working as it is intended to work:
http://www.postgresql.org/docs/8.2/intera
Luiz K. Matsumura wrote:
Richard Broersma Jr wrote:
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
CREATE VIEW view1( id, col1, type1, type2) AS
SELECT table1.id,
table1.col1,
CAST( table2.type1 AS CHARACTER( 3 )),
NULL
FROM table1
JOIN table2 ON table2.fk_tabl
Richard Broersma Jr wrote:
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
CREATE VIEW view1( id, col1, type1, type2) AS
SELECT table1.id,
table1.col1,
CAST( table2.type1 AS CHARACTER( 3 )),
NULL
FROM table1
JOIN table2 ON table2.fk_table1 = table1.id
UNION ALL
SE
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
> CREATE VIEW view1( id, col1, type1, type2) AS
> SELECT table1.id,
>table1.col1,
>CAST( table2.type1 AS CHARACTER( 3 )),
>NULL
> FROM table1
> JOIN table2 ON table2.fk_table1 = table1.id
> UNION ALL
> SELECT table1.id,
Hello,
I have a scenario like this:
CREATE TABLE table1
(
id serial NOT NULL,
col1 character varying(30),
CONSTRAINT pk_table1 PRIMARY KEY (id)
);
CREATE TABLE table2
(
fk_table1 integer,
type1 character(3),
id serial NOT NULL,
CONSTRAINT pk_table2 PRIMARY KEY (id)
);
CREATE TABLE table
I believe int8(n.udf4) will do the trick for you.
- Original Message -
From: "Judith Altamirano Figueroa" <[EMAIL PROTECTED]>
To:
Sent: Friday, October 14, 2005 12:08 PM
Subject: [SQL] cast
> Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the
On Fri, Oct 14, 2005 at 01:08:43PM -0500, Judith Altamirano Figueroa wrote:
> Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the query
> is the next:
It'd help if we could see the table schema and the error message.
A
--
Andrew Sullivan | [EMAIL PROTECTED]
When my information c
Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the query
is the next:
select n.factura,
n.venta_neta,
c.nombre_cli || ' ' || c.apellido_pat_cli || ' ' || coalesce
(c.apellido_mat_cli,''),
date(n.fecha_hora_factura),
At 12:11 AM 12/11/04, Josh Berkus wrote:
Wei,
> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null from some_other_relevant_table;
I don't think you're reporting the error exactly as it happened. Try cutting
and pasting your actual PSQL session into your e-mail.
Perhaps
On Friday 10 December 2004 11:24 am, Wei Weng wrote:
> I have a table
>
> create table temp
> (
> tempdatetimestamp,
> tempnamevarchar(10)
> );
>
> And I tried to insert the following:
>
> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null fro
On Fri, 10 Dec 2004, Wei Weng wrote:
> I have a table
>
> create table temp
> (
> tempdatetimestamp,
> tempnamevarchar(10)
> );
>
> And I tried to insert the following:
>
> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null from some_other_re
Wei,
> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null from some_other_relevant_table;
I don't think you're reporting the error exactly as it happened. Try cutting
and pasting your actual PSQL session into your e-mail.
Perhaps you are mixing up the column order?
I have a table
create table temp
(
tempdatetimestamp,
tempnamevarchar(10)
);
And I tried to insert the following:
insert into table temp (tempname, tempdate)
select distinct 'tempname', null from some_other_relevant_table;
And I got an error that says "column "tempda
Dnia 2003-11-21 19:26, Użytkownik Yudie napisał:
I don't have to_numeric function in my 7.2.2 postgre.
then it can resolve it with:
cast(substr(varcharcolumn,0) as float4)
Read once again. The function is not "to_numeric", but "to_number".
You can read about this function in manual:
6.7. Data Typ
TECTED]>
Sent: Friday, November 21, 2003 11:55 AM
Subject: Re: [SQL] cast varchar to numeric/money
On Fri, Nov 21, 2003 at 11:47:42 -0600,
Yudie <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I know it's impossible to just cast varchar to any numeric datatype,
> but is
On Fri, Nov 21, 2003 at 11:47:42 -0600,
Yudie <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I know it's impossible to just cast varchar to any numeric datatype,
> but is there another function/ custom function or any way to force to do
> that convertion.
You can use to_number to go from text to num
Hi guys,
I know it's impossible to just cast varchar to any numeric datatype,
but is there another function/ custom function or any way to force to do
that convertion.
please help
Thanks..
Yudie
---(end of broadcast)---
TIP 9: the planner will i
On Fri, 21 Mar 2003, Eric Veldhuyzen wrote:
> On Fri, Mar 21, 2003 at 04:46:17PM -0200, Achilleus Mantzios wrote:
> >
> > Currently (7.3) all input can be handled if fed as text.
> > So what you can do is simply:
> >
> > my $sth = $dbh->prepare(
> > "INSERT INTO object_def (name, meant_as_
On Fri, Mar 21, 2003 at 04:46:17PM -0200, Achilleus Mantzios wrote:
>
> Currently (7.3) all input can be handled if fed as text.
> So what you can do is simply:
>
> my $sth = $dbh->prepare(
> "INSERT INTO object_def (name, meant_as_subobject) VALUES (?,?)");
> $sth->execute('test', '0');
EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 6:58 PM
Subject: Re: [SQL] CAST from VARCHAR to INT
>
> > (Postgres 7.2.1)
> >
> > I screwed up when I was designing a table a while back and made a column
a
> > VARCHAR that referenced (a
daq <[EMAIL PROTECTED]> writes:
> Make your life easier! :) You must write a function like
> this:
> create function "int4"(character varying) returns int4 as '
>DECLARE
> input alias for $1;
>BEGIN
> return (input::text::int4);
>END;
> ' language
Hello!
Like others said you can't cast varchar to int directly.
Make your life easier! :) You must write a function like
this:
create function "int4"(character varying) returns int4 as '
DECLARE
input alias for $1;
BEGIN
return (input::text::int4);
E
"Luke Pascoe" <[EMAIL PROTECTED]> writes:
> Now I'm trying to correct my mistake, I've created a new table and I'm
> trying to INSERT INTO...SELECT the data into it, but it's complaining that
> it can't stick a VARCHAR into an INT. All the values in the column are valid
> integers (the foreign key
> (Postgres 7.2.1)
>
> I screwed up when I was designing a table a while back and made a column a
> VARCHAR that referenced (and should have been) an INT.
>
> Now I'm trying to correct my mistake, I've created a new table and I'm
> trying to INSERT INTO...SELECT the data into it, but it's compla
(Postgres 7.2.1)
I screwed up when I was designing a table a while back and made a column a
VARCHAR that referenced (and should have been) an INT.
Now I'm trying to correct my mistake, I've created a new table and I'm
trying to INSERT INTO...SELECT the data into it, but it's complaining that
it c
L PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [SQL] cast lo to oid Date: Thu, 07 Nov 2002 10:16:21 -0500
"Nekta Katz" <[EMAIL PROTECTED]> writes:
> I have the following table
> create table scan_docs (
> docid serial,
> shipno numeric(10),
> sc
L PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [SQL] cast lo to oid Date: Thu, 07 Nov 2002 10:16:21 -0500
"Nekta Katz" <[EMAIL PROTECTED]> writes:
> I have the following table
> create table scan_docs (
> docid serial,
> shipno numeric(10),
> scanlo,
"Nekta Katz" <[EMAIL PROTECTED]> writes:
> I have the following table
> create table scan_docs (
> docid serial,
> shipno numeric(10),
> scanlo,
> type text
> );
> when I try to create the following rule
> create rule "delete_scan_docs_lo" as
> on delete to "scan_docs"
> do
Hi,
I have the following table
create table scan_docs (
docid serial,
shipno numeric(10),
scanlo,
type text
);
when I try to create the following rule
create rule "delete_scan_docs_lo" as
on delete to "scan_docs"
do select lo_unlink (old.scan);
I get the error message
"psql:
On Mon, 22 Oct 2001, Esteban Gutierrez Abarzua wrote:
>
> hi.
>
> I wanna to make a query on this table(postgres system catalog):
>
> Attribute | Type| Modifier
> --+---+--
> relname | name |
> reltype | oid |
> relowner | in
hi.
I wanna to make a query on this table(postgres system catalog):
Attribute | Type| Modifier
--+---+--
relname | name |
reltype | oid |
relowner | integer |
relam| oid |
relpages | integer |
reltup
1, omid omoomi wrote:
> Sorry friend, you are right. I could not do that too. :o
> I'll look for it.
> omid
>
> >From: Bhuvan A <[EMAIL PROTECTED]>
> >To: omid omoomi <[EMAIL PROTECTED]>
> >CC: [EMAIL PROTECTED]
> >Subject: Re: [SQL] CAST(ipad
"Mattis Jiderhamn" <[EMAIL PROTECTED]> writes:
> I'm trying to create a trigger so that, if I try to insert blank, that is
> '', into a date field it will be converted to null so that I don't get
> ERROR: Bad date external representation ''
I don't think it's possible to do that with a trigger
Hi there everyone.
I'm trying to create a trigger so that, if I try to insert blank, that is
'', into a date field it will be converted to null so that I don't get
ERROR: Bad date external representation ''
I believe my ploblem is that I don't know the type of blank (''), and
therefore do not
hi,
ipaddress::text
is resulting in
ERROR: Cannot cast type 'cidr' to 'text'
how else we can???
Thankx.
On Tue, 17 Jul 2001, omid omoomi wrote:
> ie,
> ipaddrss::text
>
> >From: Bhuvan A <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
>
hi all,
how can we cast an ipaddress(type cidr) to any other type?
thankx in advance..
Regards,
Bhuvaneswar.
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROT
Now,I found the problem, but I don't know how to
solve. It depends on type float8.
I changed all type float to float8
In my function I make the following
calculation:
.
update KalkPreislisten_float8 SET kp_ep =
rkontingent.k_ep::float8 -- this works
correct
but I hav
58 matches
Mail list logo