Re: [GENERAL] Validating User Login Within Postgres

2014-07-01 Thread Sim Zacks
On 07/01/2014 06:03 PM, Rich Shepard wrote: On Tue, 1 Jul 2014, hubert depesz lubaczewski wrote: That depends. For example - for system that will have 5 users, and requires strict security policies - it would make sense. On the

Re: [GENERAL] Correct update statement

2014-05-15 Thread Sim Zacks
update contacts set addr_id=b.addr_id from (select distinct(cus_acno), contact.con_id, address.addr_id from address join person using (addr_id) join  cus using (per_id) join link_contact using (cus_acno) join contact using (con_id) where contact.addr_id is

Re: [GENERAL] Receiving many more rows than expected

2014-05-08 Thread Sim Zacks
On 05/08/2014 02:09 PM, Vincent de Phily wrote: The problem is that sometimes (once every few days at about 2-300K queries per day) I get many more rows than the max 5000 I asked for (I've seen up to 25k). And I'm getting timeouts and other problems as a result.

Re: [GENERAL] probable pg_hba.conf configuration issues

2014-05-07 Thread Sim Zacks
My bet is you have either another line in the pg_hba that says trust or you saved the password and forgot. Sim On 05/07/2014 05:33 PM, Ravi Roy wrote: Hi,   I'm sorry if this question have been asked earlier,

Re: [GENERAL] Crosstab function

2014-05-07 Thread Sim Zacks
What I have done in the past to build a generic reporting application is to have the function write the results you want in a table and return the tablename and then have the client code call select * from that table. My standard report tablename is tblrep

[GENERAL] importing downloaded data

2014-04-22 Thread Sim Zacks
Postgresql 9.3 I am downloading data that I want to import into a table. The data comes in tab delimited, CRLF format. I am using plpython to get the data and I wanted to use copy with stdin to import it without having to save it to a file. To do this, I am setting sy

Re: [GENERAL] do I need a table function to do this

2012-12-30 Thread Sim Zacks
Do you have a unique key on site,variable? If not, what do you want in the treatment column if there are rows for both treatments X and Y  or 2 Xs for a specific site and variable? If your data makes sense, you can pivot table t1 and then full

Re: [GENERAL] NOTIFY/LISTEN on server, asynchronous processing

2012-12-12 Thread Sim Zacks
I have experience with LIsten/Notify and as you mention the only problem is that I need a server side client that calls the listen and then calls a db function on the notify. One thought I had to do this completely in the database is to right notify

Re: [GENERAL] Who is LISTENing?

2012-10-16 Thread Sim Zacks
On 10/16/2012 07:49 AM, Raghavendra wrote: On Tue, Oct 16, 2012 at 11:01 AM, Sim Zacks <s...@compulab.co.il> wrote: On 10/15/2012 06:11 PM, rektide

Re: [GENERAL] Who is LISTENing?

2012-10-15 Thread Sim Zacks
On 10/15/2012 06:11 PM, rektide wrote: Hi pgsql-general, I'm interested in writing a supervisory process that can insure worker processes are running/spawn new ones if not. These workers will mainly be responsible for LISTENing to the db, which is emitting triggered_chan

Re: [GENERAL] NOTIFY/LISTEN in Postgresql

2012-10-15 Thread Sim Zacks
On 10/15/2012 02:54 PM, P. Broennimann wrote: Hi there 1) Can a Pg/SQL function "listen" for a notification sent from an external instance? I would like my stored function to pause/wait and continue its execution on

Re: [GENERAL] moving from MySQL to pgsql

2012-10-10 Thread Sim Zacks
On 10/10/2012 10:47 AM, Vineet Deodhar wrote: Hi ! At present, I am using MySQL as backend for my work. Because of the licensing implications, I am considering to shift from MySQL to pgsql. Typically, my apps are multi-user, web based or LAN based.

Re: [GENERAL] force defaults

2012-09-12 Thread Sim Zacks
I haven't checked more recent versions, but in 8.2 using     case when new.val is null then 'U' else new.val end worked a hell of a lot faster then coalesce. However, just going into the trigger is significant overhead. Alban's suggestion of using a

Re: [GENERAL] PG migration policy

2012-01-29 Thread Sim Zacks
You are moving to a dedicated server for a reason, most probably performance. The intro section of the document should discuss the reasons you are moving and what you hope to accomplish. Hardware - The discuss the new platform that you are moving to, in terms of how it will perform better. Importa

[GENERAL] left join with OR optimization

2012-01-24 Thread Sim Zacks
I've seen written that a b-tree index can't be used on a join with an OR. Is there a way to optimize a join so that it can use an index for a query such as: select a.partid,a.duedate,coalesce(a.quantity,0)+sum(coalesce(b.quantity,0)) from stat_allocated_components a left join stat_allocated_compon

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
On 01/23/2012 07:10 PM, Adrian Klaver wrote: > On Monday, January 23, 2012 7:32:35 am Sim Zacks wrote: >> On 01/23/2012 05:13 PM, Adrian Klaver wrote: > >> >> When I throw in code to make the select only return the correct rows >> The select statement takes 9 secs

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
On 01/23/2012 05:13 PM, Adrian Klaver wrote: > > I guess the primary question here is, what are you trying to achieve? > Do want a particular row to supply the values to the target table i.e the row > with the most timestamp? > What is the query you are using? > The query returns a partid, unit

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
On 01/23/2012 04:34 PM, Alban Hertroys wrote: > On 23 January 2012 14:48, Sim Zacks wrote: >>> In my tests, if the joined rows are sorted it always updates with the >>> first row. Does anyone have any other experiences, or should I be >>> concerned that at some po

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
> In my tests, if the joined rows are sorted it always updates with the > first row. Does anyone have any other experiences, or should I be > concerned that at some point it will behave differently? I checked my tests again. It always uses the last one, not the first one. Sim -- Sent via pgsql

[GENERAL] update with from

2012-01-23 Thread Sim Zacks
Postgresql 8.2 I want to update a table with a from that has mutliple rows joining to it. According to the docs, this is not advisable because: "If it does, then only one of the join rows will be used to update the target row, but which one will be used is not readily predictable." In my tests,

Re: [GENERAL] How to find owning schema in function

2011-11-06 Thread Sim Zacks
On 11/05/2011 05:36 PM, Andrus wrote: 8.1+ database contains separate schemas for every company named company1, company2, companyi. order tables in those schemas contain trigger like for company1: CREATE OR REPLACE FUNCTION dok_seq_

Re: [GENERAL] PostgreSQL Naming Rules - another question

2011-10-30 Thread Sim Zacks
On 10/29/2011 12:53 PM, Szymon Guz wrote: Hi, according to this part of documentation: http://www.postgresql.org/docs/9.1/interactive/sql-syntax-lexical.html#SQL- SYNTAX-IDENTIFIERS if I select some names from database and so

Re: [GENERAL] function "XXX" already exists with same argument types

2011-10-06 Thread Sim Zacks
On 10/05/2011 05:27 PM, Alexander Farber wrote: Thank you Michael, but no - On Wed, Oct 5, 2011 at 5:24 PM, Michael Glaesemann wrote: psql:pref-2011-10-05-a.sql:339: ERROR:  function "pref_update_match" already exists with same argument types ALTE

Re: [GENERAL] PL/Python

2011-10-03 Thread Sim Zacks
Maybe I'm misunderstanding something, but isn't such a sql file an extension or is 95% of the way there? Pyrseas is already distributed via PGXN, but like some other PGXN "extensions" (dbi-link?), it doesn't actually create functions in the database. Its two utilities run entirely as external

Re: [GENERAL] PL/Python

2011-10-02 Thread Sim Zacks
On 09/30/2011 05:10 AM, Joe Abbate wrote: Although there are no discussions or examples in the documentation, I've determined that PL/Python supports Python new style classes like class Test(object), and import of standard modules. Now, in order for to_yaml/to_map to do its

Re: [GENERAL] How to return an array of values from a function?

2011-09-15 Thread Sim Zacks
On 09/15/2011 09:13 AM, Siva Palanisamy wrote: Hi All,   I wish to return an array of values. Assume, I have a table called contacts. I want to display all the names available from a column in the UI. Hence I n

Re: [GENERAL] Security setup.

2011-09-11 Thread Sim Zacks
On 09/11/2011 02:58 PM, mgo...@isstrucksoftware.net wrote: Sim, Thanks, our users can only get to the application(s) they have on their citrix menu. They are locked out of the servers otherwise. I haven't had a problem in the past 20 years with another db back end but I do think that on th

Re: [GENERAL] Security setup.

2011-09-11 Thread Sim Zacks
The problem with trust is that it means that any user can type in any other users login name and get access without knowing his password. Even if your app is the only access point to the database, you still have to worry about a user installing psql or other client onto his desktop and accessin

Re: [GENERAL] pivoting data?

2011-09-08 Thread Sim Zacks
On 09/08/2011 03:15 PM, Joy Smith wrote: Hello Chris, yes that does seem to be a lot cleaner - though it does one thing that is not right -  ie) add to the previous data  insert into modvalues (parties,baloons,color,dayofpurchase,amountpur) values

Re: [GENERAL] conditional insert

2011-09-05 Thread Sim Zacks
On 09/05/2011 01:37 PM, Pau Marc Muñoz Torres wrote: i don't  see it clear, let me put an example i got the following table molec varchar(30) seq varchar(100) where I insert my values  lets image that i have a record introduc

Re: [GENERAL] conditional insert

2011-09-05 Thread Sim Zacks
On 09/05/2011 12:38 PM, Pau Marc Muñoz Torres wrote: Hi follk  i trying  to performe a  conditional insert into a table, indeed, what i'm trying to do is not insert a record into the table if that record exist googleling i found something like

Re: [GENERAL] md5 of table

2011-09-03 Thread Sim Zacks
I thought about using dblink and the EXCEPT query, but then I need to know the field list of each query result, which is a pain in the butt. That is not correct. As long as the table definitions are precisely the same, you can move records across dblink without specifying fields. You do this

Re: [GENERAL] md5 of table

2011-09-01 Thread Sim Zacks
OP: I thought about using dblink and the EXCEPT query, but then I need to know the field list of each query result, which is a pain in the butt. That is not correct. As long as the table definitions are precisely the same, you can move records across dblink without specifying fields. You do

Re: [GENERAL] md5 of table

2011-09-01 Thread Sim Zacks
On 09/01/2011 01:35 PM, Grzegorz Jaśkiewicz wrote: On Thu, Sep 1, 2011 at 11:14 AM, Sim Zacks wrote: On 09/01/2011 12:26 PM, Pavel Stehule wrote: Hello postgres=# create table tt(a int, b varchar); CREATE TABLE postgres=# insert into tt

Re: [GENERAL] md5 of table

2011-09-01 Thread Sim Zacks
I am not sure if this will work, but you can try it http://www.pgsql.cz/index.php/PostgreSQL_SQL_Tricks#Cast_to_varchar Pavel I appreciate your help, but UDTs don't have input/ouput functions unless you define them manually and I need this for all of my

Re: [GENERAL] md5 of table

2011-09-01 Thread Sim Zacks
On 09/01/2011 12:26 PM, Pavel Stehule wrote: Hello postgres=# create table tt(a int, b varchar); CREATE TABLE postgres=# insert into tt values(10,'hello'); INSERT 0 1 postgres=# select md5(array_to_string(array_agg(md5(tt::text)),'')) from tt; md5 ---

[GENERAL] md5 of table

2011-09-01 Thread Sim Zacks
Is there a way to get an md5 or other hash of an entire table? I want to be able to easily compare 2 tables in different databases. I thought about using dblink and the EXCEPT query, but then I need to know the field list of each query result, which is a pain in the butt. If I could return an

Re: [GENERAL] function param and declared variable of same name

2011-09-01 Thread Sim Zacks
On 09/01/2011 09:58 AM, Pavel Stehule wrote: 2011/9/1 Sim Zacks : Tested in 8.2 and 9.0.1 In plpgsql, if you have a function parameter and a variable of the same name, it ignores the value passed in and initializes the variable to null. The correct action

Re: [GENERAL] function on trigger

2011-08-31 Thread Sim Zacks
On 09/01/2011 01:39 AM, Marcos Hercules Santos wrote: hi guys I'm newbie in Psql and I'm trying to build one function in order to count the products for each supplier. So i'm gonna put it quite simply though this example Please, consider a table called books with the foll

[GENERAL] function param and declared variable of same name

2011-08-31 Thread Sim Zacks
Tested in 8.2 and 9.0.1 In plpgsql, if you have a function parameter and a variable of the same name, it ignores the value passed in and initializes the variable to null. The correct action, IMO, would be to raise an error. create or replace function test1(x int

[GENERAL] row is too big

2011-08-31 Thread Sim Zacks
select version() "PostgreSQL 8.2.19 on i686-pc-linux-gnu, compiled by GCC gcc (Debian 4.3.2-1.1) 4.3.2" Before you jump down my throat about bad design, this is a reporting table that is generated based on what the users want to see in their rows and columns. (I'm basically generating a sprea

Re: [GENERAL] heavy swapping, not sure why

2011-08-30 Thread Sim Zacks
Yes, a few hundred MB of swap, and its definitely making a huge difference. Upon restarting postgres, its all freed up, and then perf is good again. Also, this box only has 1GB of swap total, so its never going to get up a few dozen GB. Anyway, here's some of top output f

Re: [GENERAL] heavy swapping, not sure why

2011-08-30 Thread Sim Zacks
On a machine with lots of memory, I've run into pathological behaviour with both the RHEL 5 and Ubuntu 10.04 kernels where the kswapd starts eating up CPU and swap io like mad, while doing essentially nothing. Setting swappiness to 0 delayed this behaviour but did not stop i

Re: [GENERAL] Using Postgresql as application server

2011-08-18 Thread Sim Zacks
On 08/18/2011 07:57 AM, Chris Travers wrote: On Wed, Aug 17, 2011 at 9:38 PM, Sim Zacks wrote: The point was not whether I have a bug in an external application, the point is that I need an external application which creates more overhead and another point

Re: [GENERAL] Using Postgresql as application server

2011-08-17 Thread Sim Zacks
On 08/17/2011 05:34 PM, Scott Ribe wrote: On Aug 17, 2011, at 1:05 AM, Sim Zacks wrote: One problem we have with LISTEN/NOTIFY (and I haven't found the cause for this yet) is every once in a while my daemon stops listening. It may be after a month of u

Re: [GENERAL] Using Postgresql as application server

2011-08-17 Thread Sim Zacks
On 08/17/2011 06:13 PM, Chris Travers wrote: On Tue, Aug 16, 2011 at 11:53 PM, Sim Zacks wrote: We are doing this same sort of thing now. If the transaction goes through, the email record gets written to a table. We have a cron job that calls a database

Re: [GENERAL] Using Postgresql as application server

2011-08-17 Thread Sim Zacks
On 08/16/2011 07:04 AM, Darren Duncan wrote: Chris Travers wrote: On Mon, Aug 15, 2011 at 3:47 PM, Darren Duncan wrote: I believe we basically have all the foundation already, with maybe procedures executable outside transactions being the last major part. Why is this desirable? Why is it mo

Re: [GENERAL] Using Postgresql as application server

2011-08-16 Thread Sim Zacks
On 08/15/2011 11:50 PM, Chris Travers wrote: On Mon, Aug 15, 2011 at 1:44 PM, Darren Duncan wrote: I believe that it is ideal for Postgres to be computationally complete in that one *could* use it to implement a complete application. That isn't to say one should do this as a matter of course,

Re: [GENERAL] Using Postgresql as application server

2011-08-16 Thread Sim Zacks
On 08/16/2011 03:06 AM, Craig Ringer wrote: On 15/08/2011 10:36 PM, Merlin Moncure wrote: On Sat, Aug 13, 2011 at 2:30 PM, Andreas Joseph Krogh wrote: No, PG has never, and will never, act as an application-server. Why in the world not? The biggest reason is safety. Beyond that, the lack of

Re: [GENERAL] How to tame a gigantic (100+ lines) query in a web app?

2011-08-15 Thread Sim Zacks
On 08/14/2011 05:39 PM, W. Matthew Wilson wrote: Is there anything dangerous about making temporary tables in this way? Matt The only dangerous thing I have encountered with temp tables is that the planner compiles the table oid into the plan and if you

Re: [GENERAL] Filling null values

2011-08-06 Thread Sim Zacks
On 08/05/2011 07:32 PM, jeffrey wrote: I have a table that looks like this: homeidcity date measurement pre/post 123 san francisco 1/2/2003 1458 pre 123 san francisco NULL 1932 post 124 los angeles2/4/2005 938

Re: [GENERAL] eval function

2011-07-31 Thread Sim Zacks
On 07/31/2011 09:48 AM, Chris Travers wrote: On Sat, Jul 30, 2011 at 9:50 PM, Sim Zacks wrote: On one hand the hole can't be plugged because as you mentioned that is the point of the function. On the other hand, if the function is not being run as security definer, the account runni

Re: [GENERAL] eval function

2011-07-30 Thread Sim Zacks
We are in the process of building regression tests for our 700+ functions. I hope to have it finished in about 6 months. Sim On 07/31/2011 08:31 AM, Jaime Casanova wrote: 2011/7/30 Sim Zacks: On 07/28/2011 05:11 PM, Tom Lane wrote: Merlin Moncurewrites: Couple points: *) why a

Re: [GENERAL] eval function

2011-07-30 Thread Sim Zacks
On 07/28/2011 06:28 PM, Chris Travers wrote: On Thu, Jul 28, 2011 at 8:08 AM, David Johnston wrote: At best, based upon the example using "current_timestamp()", you could only mark it as being stable, right? Also not mentioned; what risk is there of this function being hacked? It places the

Re: [GENERAL] eval function

2011-07-30 Thread Sim Zacks
On 07/28/2011 05:11 PM, Tom Lane wrote: Merlin Moncure writes: Couple points: *) why a special case for boolean values? That seemed weird to me too ... I'm using 8.2 and "cannot cast type boolean to text" *) this should be immutable What if the passed expression is volatile? Better to be

[GENERAL] eval function

2011-07-28 Thread Sim Zacks
I need an eval function that will evaluate a valid SQL expression and return the value. I've seen variations of this asked before with no real answer. I wrote a function to handle it, but it looks like there should be a better way to do this (see below). My use case is a table with date ran

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-27 Thread Sim Zacks
On 07/27/2011 07:18 PM, Karl Nack wrote: The best option is to use exceptions to communicate to the application what went wrong and then allow the application to handle those exceptions in many cases. In other cases, the application may need to know which inputs are mandatory. So other than sa

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-26 Thread Sim Zacks
On 07/25/2011 06:24 PM, Chris Travers wrote: On Sun, Jul 24, 2011 at 11:53 PM, Sim Zacks wrote: The goal is to make our system client agnostic, Most of our GUI is written in wxpython, we also have some web functions and even a barcode terminal function, written in C#. We would like to use an

Re: [GENERAL] Disallow access from psql, or allow access only from specific client app

2011-07-25 Thread Sim Zacks
A lot of applications don't actually have a database role per user. There is an application user who logs into the database and the application handles application logins through a users table in the database. That way the only thing that the user has access to is the application and not the d

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-25 Thread Sim Zacks
On 07/25/2011 11:06 AM, Frank Lanitz wrote: Am 22.07.2011 21:15, schrieb Karl Nack: to move as much business/transactional logic as possible into the database, so that client applications become little more than moving data into and out of the database using a well-defined API, most commonly (b

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-24 Thread Sim Zacks
On 07/24/2011 06:58 PM, Chris Travers wrote: On Sat, Jul 23, 2011 at 11:44 PM, Sim Zacks wrote: I gave a talk on using postgresql as an application server at PG East in March. Basically, we try to implement all business logic using functions, using plpythonu when necessary. For example, we

Re: [GENERAL] Update columns in same table from update trigger?

2011-07-24 Thread Sim Zacks
On 07/22/2011 11:02 PM, Pablo Romero Abiti wrote: Here's what I want to do: I have a master table that has 2 columns: idcol1 and idcol2, where idcol2 is equivalent to idcol1 Table: color_eq idcol1 idcol2 1 1 2 2 2 3 Table: warehouse idcolqty 110 220 if I exe

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Sim Zacks
I gave a talk on using postgresql as an application server at PG East in March. Basically, we try to implement all business logic using functions, using plpythonu when necessary. For example, we have functions that send email, ftp files, sync remote databases, etc. It is important to kee

Re: [GENERAL] Alarm function in PL/pgSQL

2011-07-21 Thread Sim Zacks
On 07/19/2011 01:35 AM, Jon Smark wrote: Hi, I don't think this is really possible with postgres PLs generally. Typically what you have to do is have a function that is called on an interval that checks for alarms and runs them. Thanks for the prompt reply. Just to clarify: you are saying th

Re: [GENERAL] Web-based Graphical Query Building Tool for PostgreSQL

2011-07-14 Thread Sim Zacks
On 07/13/2011 04:02 PM, Caleb Palmer wrote: Hi all, My company sells software that uses PostgreSQL and the need has come up to provide a tool that gives our clients access to query the database but we don't want to expect these users to be able to use SQL. Is there a product out there that

Re: [GENERAL] Alter Columns with Triggers

2011-07-12 Thread Sim Zacks
I don't recall any problems with functions or triggers, in my experience the problems are with the views. Any views that are on the table must be recreated. In any case, I wrote a function a while back that can be fairly easily modified to do what you want. My function is for modifying a vi

Re: [GENERAL] Read MS-SQL data into Postgres via ODBC link?

2011-07-05 Thread Sim Zacks
I've done similar things with a plpythonu function. Basically, import the mysql module, call your select statement and then for each row do a plpy.execute(insert stmt) Sim On 07/05/2011 12:10 AM, Jonathan Brinkman wrote: Greetings I'd like to INSERT data into my Postgresql 8.4.8 table di

Re: [GENERAL] out of memory error

2011-07-03 Thread Sim Zacks
On 07/03/2011 01:00 PM, Geoffrey Myers wrote: We have a process that we successfully ran on virtually identical databases. The process completed fine on a machine with 8 gig of memory. The process fails when run on another machine that has 16 gig of memory with the following error: out of

Re: [GENERAL] PLPGSQL SETOF functions

2011-06-29 Thread Sim Zacks
Please reply to the list in the future. I don't believe you can do that. Sim On 06/29/2011 04:39 PM, David Greco wrote: Thanks that works pretty well. Is it possible to fetch the all the return of dates_pkg.getbusinessdays() into a single variable at once? i.e. in Oracle I would do somethin

Re: [GENERAL] PLPGSQL SETOF functions

2011-06-29 Thread Sim Zacks
1) If you declare a return type setof TABLENAME the resultset will contain rows with field definitions like the table. 2) To call the function from another plpgsql function use: declare row record begin for row in select * from dates_pkg.getbusinessdays(...) Loop ...process...

[GENERAL] discard on constraint violation

2011-06-27 Thread Sim Zacks
Is there a way to tell a table to discard an insert if it violates a constraint (unique in my case) instead of giving an error? I don't want the overhead of a trigger on each row inserted. My situation is that I'm reading data from an external website with lots of duplicate data. I am reading

Re: [GENERAL] determine client os

2011-06-14 Thread Sim Zacks
On 06/14/2011 10:29 AM, Craig Ringer wrote: On 14/06/11 14:35, Sim Zacks wrote: It is much simpler then that. My data includes file references. One table has the filename with a path placeholder and another table contains the windows and linux versions of the full path. This is for an

Re: [GENERAL] how to install plpython?

2011-06-14 Thread Sim Zacks
What OS/distribution are you using? If you compiled postgresql your self did you include python support? Sim On 06/14/2011 12:17 PM, AI Rumman wrote: Okay. Thanks for the guidance. Could you please tell where I can get the postgresql-python lib files? On Tue, Jun 14, 2011 at 2:01 PM, Craig Rin

[GENERAL] thoughts on interactive query

2011-06-14 Thread Sim Zacks
I am playing around with making interactive queries and was wondering if anyone had any comments. If your comment is "That is a stupid idea", please try to qualify that with something constructive as well. The idea is that sometimes during a process, user input is required. The way we have

Re: [GENERAL] determine client os

2011-06-13 Thread Sim Zacks
On 06/14/2011 08:19 AM, Tom Lane wrote: Sim Zacks writes: All the suggestions given are for the server OS :-( My purpose is to be able to return a correct file path to the client without it specifying the OS. File path? Seems to me that even if you knew the client OS, that'd provide ne

Re: [GENERAL] determine client os

2011-06-13 Thread Sim Zacks
All the suggestions given are for the server OS :-( My purpose is to be able to return a correct file path to the client without it specifying the OS. Thanks Sim On 06/13/2011 05:38 PM, Craig Ringer wrote: On 06/13/2011 08:35 PM, hubert depesz lubaczewski wrote: Please note that it wil

[GENERAL] determine client os

2011-06-13 Thread Sim Zacks
I didn't see a function for this, but is there a way in a postgresql query to determine the client OS? Thanks Sim -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Where are plpy.execute python commands issued?

2011-05-23 Thread Sim Zacks
On 05/23/2011 06:44 AM, Michael McInnis wrote: I've seen numerous references to this syntax but haven't found where you issue the command. Tried it in a testpython.py file, no luck. Can't find a plpy file anywhere. I know it's going to be simple but need help. rv = plpy.execute("SELECT * FROM

Re: [GENERAL] Remove Duplicate Words from a field

2011-05-16 Thread Sim Zacks
I would use a plpython or plperl function In python you can split the word into a list and then get unique items and put it back in a string, for example. Sim On 05/16/2011 03:34 PM, Sukuchha Shrestha wrote: Dear All, I am new to Postgresql. I have a field with lots of dublicate words

Re: [GENERAL] Bidirectional replication

2011-05-08 Thread Sim Zacks
Yeah. One nasty property that async multi master solutions share is that they change the definition of what 'COMMIT' means -- the database can't guarantee the transaction is valid because not all the supporting facts are necessarily known. Even after libpq gives you the green light that transa

Re: [GENERAL] multiple group by on same table

2011-05-04 Thread Sim Zacks
On 05/04/2011 01:51 PM, Leonardo Francalanci wrote: Hi, I'm going to need to GROUP BY the same table multiple times. That is, something like: select (some aggregate functions here) from tableA group by f1, f2 select (some other aggregate functions here) from tableA group by f3, f4 etc The

Re: [GENERAL] Bidirectional replication

2011-05-02 Thread Sim Zacks
On 05/03/2011 09:15 AM, tushar nehete wrote: Hi, Is there any way to do bidirectional replication for Postgresql Plus Advance Server 8.4.5? I tried SLONY-I but its master-slave asynchronous replication. Can we configure master-master replication by slony? Or is there any trusted tool to do

Re: [GENERAL] wnat ot edit pg_hba.conf file from command prompt

2011-05-02 Thread Sim Zacks
On 05/02/2011 02:24 PM, sm wrote: hi, i want ot modify the pg_hba.conf file from command prompt i tried this command C:\Program Files\Postgresql\8.4\bin>pgadmin3/ch:"C:/program files/postgresql/8.4/data/pg_hba.conf but with this a window gets open and there is option to change methos md5

Re: [GENERAL] "OLD." || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)

2011-05-01 Thread Sim Zacks
On 04/28/2011 10:46 PM, Basil Bourque wrote: In PL/pgSQL, how does one generically access the fields of the OLD or NEW record? I've tried code such as this: 'NEW.' || quote_ident( myColumnNameVar ) || '::varchar' But when run by an "EXECUTE" command, I get errors such as: ERROR: missin

Re: [GENERAL] plpython module import errors

2011-04-28 Thread Sim Zacks
On 04/28/2011 02:19 PM, c k wrote: Hello, I have installed postgresql 9 on fedora 14 having python 2.7. Now created plpythonu language in my database and created a simple function to calculate sum of two variables. while importing math libbrary and executing the function i got the error PL/Pytho

Re: [GENERAL] Postgres 9.0 + LDAP

2011-04-13 Thread Sim Zacks
On 04/13/2011 03:36 AM, Vinzenz Bildstein wrote: Right now the line I would add to the pg_hba.conf would look something like this: host database all CIDR ldap ldapserver=my.domain.com ldapbasedn="dc=my,dc=domain,dc=com" ldapprefix="cn=ldap,cn=users" ldapsuffix="dc=my,dc=domain,dc=com" You ne

[GENERAL] pg_restore problem with type

2011-04-10 Thread Sim Zacks
I have a backup of a database from 8.2.x and I am trying to restore it into 9.0.x In 8.2.x I used the citext data type from pgfoundry (before it was part of contrib) and it was put in the pg_catalog. In 9.0 I am using the citext data type in contrib and it put it into the public schema.

Re: [GENERAL] Protecting stored procedures

2011-04-07 Thread Sim Zacks
On 04/07/2011 03:46 PM, Michael Gould wrote: We want to protect the intellectual property of several of our stored procedures. If we put them in a separate schema in the database and only allow execute on anything in that schema would that protect our stored procedures? Best Regards It dep

Re: [GENERAL] Why security-definer functions are executable by public by default?

2011-04-05 Thread Sim Zacks
On 04/05/2011 09:41 AM, hubert depesz lubaczewski wrote: hi was pointed to the fact that security definer functions have the same default privileges as normal functions in the same language - i.e. if the language is trusted - public has the right to execute them. maybe i'm missing something im

Re: [GENERAL] Ad hoc report writer

2011-03-10 Thread Sim Zacks
On 03/10/2011 12:36 PM, ray wrote: On Jan 17, 3:39 pm, byrn...@harte-lyne.ca ("James B. Byrne") wrote: I have occasion to produce reports from our PostgreSQL database which are ephemeral. In a previous life on CODASYL installation I used areportwriter called QUIZ to dash these things off. Is th

Re: [GENERAL] Using bytea field...

2011-03-10 Thread Sim Zacks
> The question is, if it screws up and says that an image already exists > and then returns a different image when querying for it, how bad would > that be. > It'll never happen: http://stackoverflow.com/questions/862346/how-do-i-assess-the-hash-collision-probability Sure you CAN go out of

Re: [GENERAL] Why length(to_char(1::integer, '9')) = 2 ?

2011-03-09 Thread Sim Zacks
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/09/2011 03:12 PM, Dmitriy Igrishin wrote: > Hey all, > > dmitigr=> select to_char(1, '9'); > to_char > - > 1 > > dmitigr=> select length(to_char(1, '9')); > length > > 2 > > Why to_char() includes preceding blank space in the r

Re: [GENERAL] Using bytea field...

2011-03-09 Thread Sim Zacks
On 03/09/2011 01:27 PM, Sim Zacks wrote: This means that it is possible that multiple images will return the same md5 hash. OTOH, if you had an indexed md5 hash and compared the image only to the matches, that would be a fast and accurate querying method -- Sent via pgsql-general mailing list

Re: [GENERAL] Using bytea field...

2011-03-09 Thread Sim Zacks
MD5 is not collision resistant (using the immortal words of wikipedia http://en.wikipedia.org/wiki/MD5). This means that it is possible that multiple images will return the same md5 hash. The question is, if it screws up and says that an image already exists and then returns a different imag

Re: [GENERAL] ldap authentication multiple ou objects

2011-02-24 Thread Sim Zacks
On 02/24/2011 12:51 AM, Michael Black wrote: Look at the "Search Filters" and "LDAP URL" sections of http://quark.humbug.org.au/publications/ldap/ldap_tut.html . There are some samples of "wildcard" filters there. I tried a number of possibilities for the ldap url based on the LDAP URL section

Re: [GENERAL] ldap authentication multiple ou objects

2011-02-24 Thread Sim Zacks
On 02/23/2011 10:27 PM, Magnus Hagander wrote: On Wed, Feb 23, 2011 at 11:43, Sim Zacks wrote: Is there a way to do ldap authentication in pg_hba on a structure that has multiple ou objects? Lets say I have an ou=Users and then an ou per dept. I want the ldap to do authentication no matter

Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Sim Zacks
a regular varchar or text field. On 02/23/2011 02:09 PM, Gaini Rajeshwar wrote: Hi All, I wanted to store ip addresses in table. I wanted to support the following 3 types of ip addresses. |*1. Wildcard format :* 1.2.3.* * *| |*2. CIDR format:* 1.2.3/24 OR 1.2.3.4/2

[GENERAL] ldap authentication multiple ou objects

2011-02-23 Thread Sim Zacks
Is there a way to do ldap authentication in pg_hba on a structure that has multiple ou objects? Lets say I have an ou=Users and then an ou per dept. I want the ldap to do authentication no matter which ou the user is in. My current ldap string is: ldap://ldap.server.local/Users;uid=;,ou=User

Re: [GENERAL] multiple tables as a foreign key

2011-02-21 Thread Sim Zacks
On 02/21/2011 12:40 AM, matty jones wrote: I am not sure if this is possible but is there a way that I can have multiple columns from different tables be a foreign key to a single column in another table, or do I need to write a check function and if so how could I set up a relation? CREATE

Re: [GENERAL] pg_dump with select output

2011-02-16 Thread Sim Zacks
On 02/16/2011 11:54 AM, Adarsh Sharma wrote: Dear all, I am using pg_dump in Postgresql database very often and read several parameters of it. But today i want to back up that part of table which satisfies satisfies certain condition ( select command ). In mysql , this is achieved as below

  1   2   3   4   5   >