Re: [SQL] Fetching BLOBs

2006-12-19 Thread Richard Huxton
Ashish Ahlawat wrote: Hi team I have a very intersting question to all of you. Pls help me to build this query, I want to fetch more that 70,000 BLOB from different customer servers. the issue is there are some BOLB files with common names on all servers. So I want merge these files into a singl

[SQL] Fetching BLOBs

2006-12-19 Thread Ashish Ahlawat
Hi team I have a very intersting question to all of you. Pls help me to build this query, I want to fetch more that 70,000 BLOB from different customer servers. the issue is there are some BOLB files with common names on all servers. So I want merge these files into a single BLOB during fetching

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Tom Lane
"Hector Villarreal" <[EMAIL PROTECTED]> writes: >select into a now() - ($1::text||'days')::interval; People keep suggesting variants of that as ways to convert numeric values to intervals, but it's really extremely bad practice. Much better is to use number-times-interval multiplication:

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Hector Villarreal
In case it is a version issue: This should always work regardless of version: Just cast the $1 variable as text followed by interval: create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - ($1::text||'days')::interval; retu

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Milen A. Radev
Richard Ray написа: > On Tue, 19 Dec 2006, Milen A. Radev wrote: > >> Richard Ray : >>> How should this be properly quoted >>> >>> create or replace function test(integer) returns setof text as $$ >>> declare >>> a record; >>> begin >>> select into a now() - interval '$1 day'; >>>

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread A. Kretschmer
am Tue, dem 19.12.2006, um 14:09:37 -0600 mailte Richard Ray folgendes: > How should this be properly quoted > > create or replace function test(integer) returns setof text as $$ > declare > a record; > begin > select into a now() - interval '$1 day'; > return next a; > return; > end > $$

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Richard Ray
On Tue, 19 Dec 2006, Milen A. Radev wrote: Richard Ray : How should this be properly quoted create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - interval '$1 day'; return next a; return; end $$ language 'plpgsql';

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Richard Ray
On Tue, 19 Dec 2006, Hector Villarreal wrote: Hi Not sure about $1 parms : you may need to use a variable to set $1 to then cast it as interval : create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - ($1::text||'days')::inter

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Hector Villarreal
Hi Not sure about $1 parms : you may need to use a variable to set $1 to then cast it as interval : create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - ($1::text||'days')::interval; return next a; return; end $$

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Milen A. Radev
Richard Ray написа: > How should this be properly quoted > > create or replace function test(integer) returns setof text as $$ > declare > a record; > begin > select into a now() - interval '$1 day'; > return next a; > return; > end > $$ language 'plpgsql'; > > I'm not having a lot of luc

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Jim Buttafuoco
Try select into a now() - interval ($1 || ' day') -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Ray Sent: Tuesday, December 19, 2006 3:10 PM To: pgsql-sql@postgresql.org Subject: [SQL] Help with quotes in plpgsql How should this be properly qu

[SQL] Help with quotes in plpgsql

2006-12-19 Thread Richard Ray
How should this be properly quoted create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - interval '$1 day'; return next a; return; end $$ language 'plpgsql'; I'm not having a lot of luck Thanks Richard ---

Re: [SQL] Desc table

2006-12-19 Thread Richard Huxton
[EMAIL PROTECTED] wrote: Hi ALL I have a Quick/small Question. Well today is the first day for me in the Postgresql. I want to "describe table" can any one tell me how to do it in postgresql. If in psql, try \d See the psql section of the manual for details. Most GUI tools (e.g. pgadmin)

[SQL] Desc table

2006-12-19 Thread Suma.Bommagani
Hi ALL I have a Quick/small Question. Well today is the first day for me in the Postgresql. I want to "describe table" can any one tell me how to do it in postgresql. thanks Suma Bommagani

Re: [SQL] null values in non-nullable column

2006-12-19 Thread Richard Huxton
George Pavlov wrote: Even though, as Tom Lane explained, CREATE TABLE AS is not the problem here, it seems to me that might be the cleanest, least obtrusive place to add validation. If C.T.A failed at the table creation step because of the JOIN-produces NULLs that would be an early and decent war

Re: [SQL] null values in non-nullable column

2006-12-19 Thread George Pavlov
Yes, the thread did not seem to go very far. The SQL standard does seem inconsistent in this area, but that is not an argument for allowing data constraint violation. Until the standard is modified I think it would be good for the reputation of the DBMS we all love to come up with a fix... Even t

Re: [SQL] Query a select that returns....

2006-12-19 Thread Achilleas Mantzios
Στις Τρίτη 19 Δεκέμβριος 2006 16:01, ο/η Carlos Santos έγραψε: > Hi! > I need to query a select that returns all the fields of an specific primary > key, but I don't have the single column's name that is constrained as > primary key. How can I do that? > Something like: > SELECT * FROM myTable WHE

Re: [SQL] null values in non-nullable column

2006-12-19 Thread Markus Schaber
Hi, George, "George Pavlov" <[EMAIL PROTECTED]> wrote: > In 8.1 I have a situation where nullability of user defined datatypes > does not seem to be enforced. Using the following steps I end up with a > table that has a column that should not be nullable, but has nulls in > it. Ouch. That hurts!

Re: [SQL] Autovaccum

2006-12-19 Thread Markus Schaber
Hi, Ezequias, "Ezequias Rodrigues da Rocha" <[EMAIL PROTECTED]> wrote: > What is the interval of time the vacuum will run on my database ? That depends on your settings and load. Autovacuum looks at every table, and checks the number of modifications, as well as the total number of transactions

[SQL] Query a select that returns all the fields of an specific value of primary key without knownig the name of the single column's primary key?

2006-12-19 Thread Carlos Santos
Hi! I need to query a select that returns all the fields of an specific primary key, but I don't have the single column's name that is constrained as primary key. How can I do that? Something like: SELECT * FROM myTable WHERE myTable.pkey = 'foo'; Thanks Carlos Henrique Iazzetti Santos Compe