Re: [SQL] [ADMIN] Postgres Array Traversing Problem

2007-10-05 Thread Dawid Kuroczko
On 10/4/07, yogesh <[EMAIL PROTECTED]> wrote:
> Hello Friends,
>
>  I have a Problem in Accessing Arrays in the Postgres.
>  The Description of my problem is given
> here:---
>  I have two array of numeric types. One That stores the IDs and Other
> Store their values at respective position.
>   One Id could be in more than one Row's Array. Now i have to search
> the ID if it is present in the Array or not.

Any specific reason why you use arrays instead of normalizing your
schema?

>   If present then at what position and to retrieve the corresponding
> ID and its Valuepresent in the other table..
> Is there any solution of itIf any Body knows please
> reply me as soon as possible...

You should use pgsql-sql@postgresql.org list for this type
of questions.

The safest route would be to use PL/pgSQL procedure which
iterates the array elements.  It should be quite simple.
Play with this.

  Regards,
Dawid

---(end of broadcast)---
TIP 6: explain analyze is your friend


[SQL] pg_dump question

2007-10-05 Thread Judith

 Hello every body!!  I have a quesyion respect pg_dump...

   I need to backup the db structure, I suposse that I do with pg_dump 
-s, but I want to restore but just with some tables with the db 
catalogues, can I do this?, I mean, restore al the db structure without 
data and after restore the data of the catalogues tables??



---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org


Re: [SQL] pg_dump question

2007-10-05 Thread Erik Jones

On Oct 5, 2007, at 11:58 AM, Judith wrote:


 Hello every body!!  I have a quesyion respect pg_dump...

   I need to backup the db structure, I suposse that I do with  
pg_dump -s, but I want to restore but just with some tables with  
the db catalogues, can I do this?, I mean, restore al the db  
structure without data and after restore the data of the catalogues  
tables??


Don't worry about the catalog tables.  If all you want is the schema  
dumped and restored then, yes, use the -s flag.  The data in the  
catalog tables is built as the schema is rebuilt during the restore,  
i.e postgres takes care of those for you.


Erik Jones

Software Developer | Emma®
[EMAIL PROTECTED]
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate


[SQL] valid query runs forever?

2007-10-05 Thread Aroon Pahwa

I'm having a strange issue with postgres...I think.

I have the following query:

GRANT SELECT ON 'tablename' TO 'username';

As far as I can tell, thats a valid query.  It works fine when I run it 
under the psql command line interface and executed against a remote db.


When I try and run the same query in pg-Admin from the same machine to 
the same remote db, however, the query never terminates.  It just runs 
forever.  I've let it run for about a half hour before.  psql returns 
almost immediately.


I've run into the same kind of behavior when attempting to execute a 
stored procedure from code.  The specific instance looked something like 
this in C# .NET using the Npgsql data provider:


using (NpgsqlConnection conn = new NpgsqlConnection(connString))
using (NpgsqlCommand command = new pgsqlCommand("Function(:a,:b)", conn))
{
conn.Open();
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("a", DbType.Double).Value = this.a;
command.Parameters.Add("b", DbType.Double).Value = this.b;
result = command.ExecuteScalar();
}

In this case, the user specified in the connection string has SELECT 
rights on the appropriate table but did not have EXECUTE rights on the 
stored proc.  The code would block at 'command.ExecuteScalar();' 
forever.  Granting execute rights resolved the issue and everything 
returned as expected.  I've reproduced the same issue using the pgODBC 
driver as well.  The code looks almost exactly the same.


Has anyone else encountered these issues?  In the former case, I don't 
understand why the query would fail.  Using the explain option from the 
title bar (ie. F7) gave a syntax error at a random character in the 
query. Usually character 9 (the 'L' in "SELECT") but sometimes a 
different one.  In the latter case I at least expected postgres to 
return some kind of error.  Any insights into this would be helpful!


BTW, specs of the machine I'm running postgres on and other details:

Win2k3 Server x64
AMD Opeteron 2GHz
loads of RAM
postgres 8.2
no firewalls of any kind on either box involved
the latter issue was running in a multithreaded/concurrent access 
environment but I don't have any issues with queries when the user has 
all the necessary rights even under enormous load and I consistently 
have issues on the very first query when I would expect a permissions error.


Also, not sure if this fit in the general mailing list or just the sql 
mailing list. Sorry if this is off topic in general.


Thanks,
Aroon

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly