Re: [SQL] CROSS-TAB query help? I have read it cant be done in on

2004-08-16 Thread Theo Galanakis
Title: RE: [SQL] CROSS-TAB query help? I have read it cant be done in one SQL, pro ve them wrong! Thanks Rickard Max may not work as not all the data is numerical. However I will give the contrib/cross-tab a go! Theo -Original Message- From: Richard Huxton [mailto:[EMAIL PROTECTED]]

Re: [SQL] Verifying data type

2004-08-16 Thread Tom Lane
=?ISO-8859-1?Q?Elieser_Le=E3o?= <[EMAIL PROTECTED]> writes: > I need to verify if the data in p_valor is just number or it is a string. > What is the best way to do this? In PG 8.0 you can just do it exactly the way your Oracle original does, viz try to cram it into a numeric variable and catch th

[SQL] Verifying data type

2004-08-16 Thread Elieser Leão
Hello guys, I have a function like this CREATE OR REPLACE FUNCTION "public"."f_tipo_campo" (varchar) RETURNS numeric AS 'declare p_valor ALIAS FOR $1; v_resultado varchar; begin v_resultado := 1; <> return v_resultado; <>end; <><>' LANGUAGE 'plpgsql' <> <> I need to verify if the data in p_

Re: [SQL] any chance SQL ASSERTIONS will be implemented?

2004-08-16 Thread Peter Eisentraut
Markus Bertheau wrote: > in the course of designing a database schema and ensuring integrity > everywhere I have stumbled over a problem that Josh told me > ASSERTIONS would solve. Is there any chance ASSERTIONS will be > implemented in PostgreSQL? There is a pretty good chance, but there is no te

[SQL] any chance SQL ASSERTIONS will be implemented?

2004-08-16 Thread Markus Bertheau
Hi, in the course of designing a database schema and ensuring integrity everywhere I have stumbled over a problem that Josh told me ASSERTIONS would solve. Is there any chance ASSERTIONS will be implemented in PostgreSQL? Thanks -- Markus Bertheau <[EMAIL PROTECTED]> -

Re: [SQL] SQL_ASCII and UNICODE server_encoding

2004-08-16 Thread Achilleus Mantzios
O kyrios Tom Lane egrapse stis Aug 16, 2004 : > Achilleus Mantzios <[EMAIL PROTECTED]> writes: > > So if SQL_ASCII should be fine for UTF-8 storage. > > (here i must have missed something, tho..), whats > > the purpose of server_encoding=UNICODE? > > If you use SQL_ASCII, the server will *store*

Re: [SQL] SQL_ASCII and UNICODE server_encoding

2004-08-16 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > So if SQL_ASCII should be fine for UTF-8 storage. > (here i must have missed something, tho..), whats > the purpose of server_encoding=UNICODE? If you use SQL_ASCII, the server will *store* Unicode just fine, but it won't *know* it is Unicode. So i

[SQL] SQL_ASCII and UNICODE server_encoding

2004-08-16 Thread Achilleus Mantzios
Hi, i'd like to ask if there is any difference in server_encoding SQL_ASCII and UNICODE (there must be one since the different terms), but AFAIU -databases which store in SQL_ASCII (i.e. server_encoding=SQL_ASCII) have no problem storing 8bit chars with the first bit set. -databases with server

Re: [SQL] Inheriting text[] field

2004-08-16 Thread Tom Lane
Kaloyan Iliev Iliev <[EMAIL PROTECTED]> writes: > I am useing PostgreSQL 7.2.3. > test_libvar=# create table temp_a( > test_libvar(# name text[] > test_libvar(# ); > CREATE > test_libvar=# create table temp( name text[] ) inherits (temp_a); > NOTICE: CREATE TABLE: merging attribute "name" with in

Re: [SQL] Returning A Varchar From A Function

2004-08-16 Thread George Weaver
Hi Richard, What happens if you just do: where trim(status) = trim($1) Regards, George - Original Message - From: "Richard Hurst" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 12, 2004 4:04 AM Subject: [SQL] Returning A Varchar From A Function > Hi > > this has

Re: [SQL] CROSS-TAB query help? I have read it cant be done in one

2004-08-16 Thread Richard Huxton
Theo Galanakis wrote: Does anyone know how to perform a cross-tab query in ONE SQL without having to write a SP? The SQL at the end of this email attempts to display the subquery result-set in a cross-tab format, it does not group the content onto one row as it should in the sample below. SQL is be

Re: [SQL] duplicate table in two databases

2004-08-16 Thread Richard Huxton
Fabio Ferrero wrote: I use postgres 7.2.1 (debian woody) and PHP. I've two databases (foo and bar for example) with the same table (ie. stamps). It's possible with a single query transfer the data from the stamps table in db foo to the stamps table in db bar? You might want to look in the contri

[SQL] Inheriting text[] field

2004-08-16 Thread Kaloyan Iliev Iliev
Dear Friend, I have the following problem when I try to inherits one table with text[] field into another. I am useing PostgreSQL 7.2.3. I suppose that this is a BUG but I am not sure. Any ides. 10x in advance. Kaloyan test_libvar=# create table temp_a( test_libvar(# name text[] test_libvar(# )