Re: [SQL] Backward compatibility psql 8.1 to 8.2

2008-02-15 Thread Scott Marlowe
Up until 8.2 I never used packages because I ran RH or FC and built from source since 6.5.2 or so. I started using packages with ubuntu, and having 8.0, 8.1, and 8.2 installed at the same time, and it's wonderful for troubleshooting issues that might crop up between versions. The Debian / Ubuntu

Re: [SQL] Backward compatibility psql 8.1 to 8.2

2008-02-15 Thread Bryce Nesbitt
I'm running SUSE 10.3. I have to install something behind the back of the package manager to keep two versions of psql around. Its not the end of the world, but it's a hassle... and fiddly in it's own right. A 8.2/8.3 client that could talk to 8.1 would save hassle here. Richard Huxton wrote: >

Re: [SQL] FUNCTIONs and CASTs

2008-02-15 Thread Dean Gibson (DB Administrator)
On 2008-02-15 15:03, Dean Gibson (DB Administrator) wrote: On 2008-02-15 14:32, Tom Lane wrote: Casing a TEXT item to a CHAR( 9 ) item isn't a no-op. I've seen this before in "EXPLAIN ..." output, where a search on an indexed column will be sequential because the planner treats the search val

Re: [SQL] FUNCTIONs and CASTs

2008-02-15 Thread Dean Gibson (DB Administrator)
On 2008-02-15 14:32, Tom Lane wrote: "Dean Gibson (DB Administrator)" <[EMAIL PROTECTED]> writes: Again, you are not understanding my point. My point was that specifying tablename.columnname%TYPE notation doesn't help with the performance problem; I have to explicitly cast the parameter in

Re: [SQL] FUNCTIONs and CASTs

2008-02-15 Thread Tom Lane
"Dean Gibson (DB Administrator)" <[EMAIL PROTECTED]> writes: > Again, you are not understanding my point. My point was that specifying > tablename.columnname%TYPE notation doesn't help with the performance > problem; I have to explicitly cast the parameter in the body of the > function. The r

Re: [SQL] String function to Find how many times str2 is in str1?

2008-02-15 Thread Emi Lu
Pavel Stehule wrote: Hello what about CREATE OR REPLACE FUNCTION Foobar(text, text) RETURNS integer AS $$ SELECT array_upper(string_to_array($1,$2),1) - 1; $$ LANGUAGE SQL IMMUTABLE; On 15/02/2008, Rodrigo E. De León Plicet <[EMAIL PROTECTED]> wrote: On Fri, Feb 15, 2008 at 11:09 AM, Emi Lu <

Re: [SQL] String function to Find how many times str2 is in str1?

2008-02-15 Thread Pavel Stehule
Hello what about CREATE OR REPLACE FUNCTION Foobar(text, text) RETURNS integer AS $$ SELECT array_upper(string_to_array($1,$2),1) - 1; $$ LANGUAGE SQL IMMUTABLE; On 15/02/2008, Rodrigo E. De León Plicet <[EMAIL PROTECTED]> wrote: > On Fri, Feb 15, 2008 at 11:09 AM, Emi Lu <[EMAIL PROTECTED]> wro

Re: [SQL] FUNCTIONs and CASTs

2008-02-15 Thread Dean Gibson (DB Administrator)
On 2008-02-15 01:38, Richard Huxton wrote: Dean Gibson (DB Administrator) wrote: On 2008-02-14 15:19, Tom Lane wrote: It's not exactly clear what you checked, but it works as expected for me. See test case below, proving that indexscan works just fine with a parameter declared using %type.

Re: [SQL] String function to Find how many times str2 is in str1?

2008-02-15 Thread Rodrigo E. De León Plicet
On Fri, Feb 15, 2008 at 11:09 AM, Emi Lu <[EMAIL PROTECTED]> wrote: > Str1 = "test test caa dtest testing EndofString"; > Str2 = " "; > > select funcName(Str1, Str2); > > return 5 CREATE OR REPLACE FUNCTION FOOBAR(TEXT,TEXT) RETURNS INT AS $$ SELECT(LENGTH($1) - LENGTH(REPLACE(

[SQL] String function to Find how many times str2 is in str1?

2008-02-15 Thread Emi Lu
Good morning, Is there a string function in PSQL to count how many times one str is in another string? For example, Str1 = "test test caa dtest testing EndofString"; Str2 = " "; select funcName(Str1, Str2); return 5 Because Str1 has 5 Str2. Thanks ! Ly --

Re: [SQL] Function description

2008-02-15 Thread Bart Degryse
>>> Gavin 'Beau' Baumanis <[EMAIL PROTECTED]> 2008-02-15 13:33 >>> >I MUST have a local / development database for testing and educational / >learning purposes - unless of course you would like me to use the production >server for testing? I do have a development database, but not locally. And

Re: [SQL] Function description

2008-02-15 Thread Gavin 'Beau' Baumanis
Bart, You just need to put forward an appropriate case. It isn't a case of I would like these things. It is, I MUST have these things in order to perform my job. I MUST have a local / development database for testing and educational / learning purposes - unless of course you would like me to

Re: [SQL] Function description

2008-02-15 Thread Bart Degryse
>>> Gavin 'Beau' Baumanis <[EMAIL PROTECTED]> 2008-02-15 12:46 >>> >The windows installer, available at; >http://www.postgresql.org/ftp/win32/ >Allows you to install the DB and / OR the tools including psql >So you can just install the psql command line tool onto your local machine. I can't instal

Re: [SQL] Function description

2008-02-15 Thread Bart Degryse
I can't install applications on my desktop pc ICT won't install that application on my desktop pc... that would require an amout of trust and... >>> Richard Huxton <[EMAIL PROTECTED]> 2008-02-15 12:17 >>> Well, the windows installer comes with the backend database server, psql.exe, pgadmin, manua

Re: [SQL] Packages

2008-02-15 Thread Bart Degryse
As far as I know not like it exists in Oracle. Alternatively you can use a schema per package, but it doesn't solve eg package variables and constants. Personally I just let my functionnames start with the "package name", so I have general_log(...), general_log_err(...), replicate_exact(...), re

[SQL] Packages

2008-02-15 Thread Jyoti Seth
Hi, Is there any concept of Package in postgresql to group functions ? Thanks, Jyoti Seth

Re: [SQL] Function description

2008-02-15 Thread Gavin 'Beau' Baumanis
Hi Bart, Bart Degryse wrote: Richard Huxton <[EMAIL PROTECTED]> 2008-02-15 11:50 >>> >>> To see how e.g. \dC etc work start psql with -E >>> >> I'm sorry, but I don't have commandline access to the database. That would >> require an amount of trust and a level of competence our ICT depart

Re: [SQL] Function description

2008-02-15 Thread Richard Huxton
Bart Degryse wrote: Richard Huxton <[EMAIL PROTECTED]> 2008-02-15 11:50 >>> To see how e.g. \dC etc work start psql with -E I'm sorry, but I don't have commandline access to the database. That would require an amount of trust and a level of competence our ICT department is incapable of. Well,

Re: [SQL] Function description

2008-02-15 Thread Bart Degryse
Richard Huxton <[EMAIL PROTECTED]> 2008-02-15 11:50 >>> >>> To see how e.g. \dC etc work start psql with -E >>> >> I'm sorry, but I don't have commandline access to the database. That would >> require an amount of trust and a level of competence our ICT department is >> incapable of. > >Well,

Re: [SQL] Function description

2008-02-15 Thread Richard Huxton
Bart Degryse wrote: Richard Huxton <[EMAIL PROTECTED]> 2008-02-15 11:15 >>> Dont' forget to cc: the list Bart :-) My mistake, sorry. Normally I only reply to the list and not to the respondent's personal address. Would that be wrong too? Well, some people prefer to reply directly from their

Re: [SQL] Function description

2008-02-15 Thread Bart Degryse
>>> Richard Huxton <[EMAIL PROTECTED]> 2008-02-15 11:15 >>> >Dont' forget to cc: the list Bart :-) My mistake, sorry. Normally I only reply to the list and not to the respondent's personal address. Would that be wrong too? > >Bart Degryse wrote: >> Thanks for that explanation Richard. >> But ho

Re: [SQL] Function description

2008-02-15 Thread Richard Huxton
Dont' forget to cc: the list Bart :-) Bart Degryse wrote: Thanks for that explanation Richard. But how can I know what they repeat without having documentation. I mean, how about functions like eg regexeqjoinsel, regexeqsel, reltimeeq, reltimege. I can imagine they mimic some other functionalit

Re: [SQL] FUNCTIONs and CASTs

2008-02-15 Thread Richard Huxton
Dean Gibson (DB Administrator) wrote: On 2008-02-14 15:19, Tom Lane wrote: It's not exactly clear what you checked, but it works as expected for me. See test case below, proving that indexscan works just fine with a parameter declared using %type. Consider: CREATE TABLE zzz( aaa CHAR( 10 )

Re: [SQL] Function description

2008-02-15 Thread Richard Huxton
Bart Degryse wrote: Hi all, I find some 1553 functions in pg_catalog of which only a small part is documented in the manual. Does anyone know where I can find what the others do with maybe an example. There's no other documentation (apart from the source) but most are repetitions and conversi

[SQL] Function description

2008-02-15 Thread Bart Degryse
Hi all, I find some 1553 functions in pg_catalog of which only a small part is documented in the manual. Does anyone know where I can find what the others do with maybe an example.