mailing.database.pgsqlsql
  Home FAQ Contact Sign in
mailing.database.pgsqlsql only
 
Advanced search
August 2008
motuwethfrsasuw
    123 31
45678910 32
11121314151617 33
18192021222324 34
25262728293031 35
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007    
total
mailing.database.pgsqlsql Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Re: [SQL] Cursors..         


Author: Yura Gal
Date: Aug 19, 2008 01:45

Take a look at http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html
and you'll find answer you need.
> I need to convert this cursor of Oracle to Postgres...
> I wait for your help!!

--
Best regards, Yuri.

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
no comments
  Re: [SQL] Select function with set return type         


Author: Andreas Kretschmer
Date: Aug 18, 2008 04:12

Nacef LABIDI gmail.com> schrieb:
> Hi all,
>
> I am writing some functions with retrun type as a SETOF of a datatype that I
> have defined. How can I test them with a select statement.
> Doing select my_function(); return set valued function called in context that
> cannot accept a set

Try 'select * from my_function();'

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
no comments
  [SQL] INSERT or UPDATE         


Author: Andreas Kraftl
Date: Aug 18, 2008 00:44

Hello

I have an XML file, which i must import into the database. I transform
this XML File with xslt to sql INSERTS.

But there is also the possibility, that one row is available. Means that
i need an UPDATE instead of the INSERT.

Is it in SQL possible to decide if there is an UPDATE or an INSERT or
must i program something with PHP for example?

Thanks
Andreas

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
no comments
  Re: [SQL] Cursor         


Author: Joe
Date: Aug 16, 2008 11:54

Xavier Bermeo wrote:
> Hi, guys.......
>
> I have problems with cursosrs.
>
> Anyone have an example complete the how load and read each position
> of a cursor?
>
> I wait your answer........
>
> Thanks.......guys

Assuming you're using ECPG, there are a couple of examples in the
documentation, e.g.,

http://www.postgresql.org/docs/8.3/static/ecpg-commands.html
(see Select using cursors:

http://www.postgresql.org/docs/8.3/static/ecpg-variables.html#AEN33442

The essence is you DECLARE the cursor, OPEN it and then FETCH rows in
some kind of loop, and finish by CLOSE cursor. To exit the loop, you
can check sqlca.sqlcode for 100 (NOT FOUND) or a SQLSTATE of 02000.
Show full article (0.85Kb)
no comments
  Re: [SQL] Join question         


Author: Steve Midgley
Date: Aug 15, 2008 14:34

At 12:20 PM 8/15/2008, pgsql-sql-owner@postgresql.org wrote:
>Date: Fri, 15 Aug 2008 13:46:14 -0400
>From: "Edward W. Rouse" comsquared.com>
>To: postgresql.org>
>Subject: Re: Join question
>Message-ID: <04da01c8fefe$d01f9c60$705ed520$@com>
>
>I did try that, but I can't get both the values from table a with no
>entries
>in table b and the values from table b with null entries to show up.
>It's
>either one or the other.
>
>Edward W. Rouse

Might have luck with applying some additional WHERE clause criteria to
your full outer join. So if you don't want certain types NULL's in
table b, restrict against that in WHERE clause? I could be
misunderstanding the whole thing though..

Steve
Show full article (0.87Kb)
no comments
  Re: [SQL] DELETE with JOIN         


Author: felix
Date: Aug 7, 2008 20:54

On Thu, Aug 07, 2008 at 10:55:17PM -0400, Joe wrote:
> I recall a similar problem ages ago and IIRC it was due to Oracle's locking
> configuration, i.e., some parameter had to be increased and the instance
> restarted so it could handle the transaction (or it had to be done in
> chunks).

I gather that the general consensus is that Oracle and Postgresql are
different enough that I will have to figure them out independently. I
have found that Postgresql is more tolerant of operator ignorance, so
I had hoped that any Oracle solution would work elsewhere, but maybe
not.

Thanks for the helpful responses.

--
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o
Show full article (1.07Kb)
no comments
  Re: [SQL] DELETE with JOIN         


Author: Alvaro Herrera
Date: Aug 7, 2008 15:12

felix@crowfix.com wrote:
> On Thu, Aug 07, 2008 at 03:58:51PM -0400, Tom Lane wrote:
>> felix@crowfix.com writes:
>>> I have tried to do this before and always found a way, usually
>>
>>> DELETE FROM a WHERE a.b_id IN (SELECT id FROM b WHERE second_id = ?)
>>
>>> but I have too many rows, millions, in the IN crowd, ha ha, and it
>>> barfs.
>>
>> Define "barfs". That seems like the standard way to do it, and it
>> should work.
>
> In this case, the first database I tried was Oracle, and it complained
> of too much transactional data; I forget the exact wording now.

I suggest you do not assume that Oracle implementation details apply to
Postgres, because they do not, most of the time. They certainly don't
in this case.
Show full article (1.05Kb)
2 Comments
  Re: [SQL] more than 1000 connections         


Author: Craig Ringer
Date: Aug 5, 2008 17:06

Jorge Medina wrote:
> hi guys
>
> I know this list it's about SQL, but if somebody have a pgsql engine
> with 1000 or more concurrent connections please show me the
> postgresql.conf or if the pgpool work as a solution to this problem.

Out of interest - why 1000 connections?

Do you really expect to have 1000 jobs concurrently active and doing
work? If you don't, then you'll be wasting resources and slowing things
down for no reason. There is a connection overhead in PostgreSQL - IIRC
mostly related to database-wide locking and synchronization, but also
some memory for each backend - that means you probably shouldn't run
vastly more backends than you intend to have actively working.

If you described your problem, perhaps someone could give you a useful
answer. Your mention of pgpool suggests that you're probably using a web
app and running into connection count limits, but I shouldn't have to
guess that.

--
Craig Ringer
Show full article (1.09Kb)
1 Comment
  [SQL] Case Insensitive searches         


Author: Mike Gould
Date: Aug 4, 2008 06:54

In the application that we are working on, all data searches must be case insensitive.

Select * from test where column1 = 'a' and Select * from test where column1 = 'A' should always be the same and use the index if column1 is indexed. In order to do this am I going to be required to use the lower() on all selects in order to make sure that they are case insensitive? In some db's if you use a lower() or upr() it will always do a table scan instead of using a index

Best Regards,

Michael Gould, Manager Information Technology
All Coast Intermodal Services, Inc.
First Coast Intermodal Services, Inc.
First Coast Logistical Services, LLC.
904-226-0978

BODY{font:10pt Tahoma, Verdana, sans-serif;}

In the application that we are working on, all data searches must be case insensitive. 
 
Select * from test where column1 = 'a' and Select * from test where column1 = 'A' should always be the same and use the index if column1 is indexed.  In order to do this am I going to be required to use the lower() on all selects in order to make sure that they are case insensitive?  In some db's if you use a lower() or upr() it will always do a table scan instead of using a indexBest Regards,Michael Gould, Manager Information TechnologyAll Coast Intermodal Services, Inc.First Coast Intermodal Services, Inc.First Coast Logistical Services, LLC.904-226-0978
 
 
no comments
  Re: [SQL] A table with two names or table alias         


Author: Igor Neyman
Date: Jul 25, 2008 08:25

There are no synonyms in Postgres (like in Oracle).
To implement what you want, you need to use views and rules.
From Postgres docs:
"Currently, views are read only: the system will not allow an insert,
update, or delete on a view. You can get the effect of an updatable view
by creating rules that rewrite inserts, etc. on the view into
appropriate actions on other tables."

Read docs on views and rules.

HTH,
Igor

-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Tk421
Sent: Friday, July 25, 2008 8:13 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] A table with two names or table alias

Can I create a table name alias?

What i want is to access the same table with two different names. An
example:
Show full article (1.37Kb)
no comments
1 2 3 4 5 6 7 8 9