[GENERAL] RAISE with C?

2010-12-20 Thread Elliot Chance
Hi, Is it possible to do the equivalent of RAISE EXCEPTION inside a C-function? Like this: PG_FUNCTION_INFO_V1(check_something); Datum check_something(PG_FUNCTION_ARGS) { // RAISE EXCEPTION 'bla bla' } CREATE OR REPLACE FUNCTION do_check() RETURNS text AS $$ BEGIN PERFORM check

Re: [GENERAL] RAISE with C?

2010-12-20 Thread Pavel Stehule
Hello 2010/12/20 Elliot Chance : > Hi, > > Is it possible to do the equivalent of RAISE EXCEPTION inside a C-function? > Like this: > > sure, there are functions elog and ereport Regards Pavel Stehule > PG_FUNCTION_INFO_V1(check_something); > Datum check_something(PG_FUNCTION_ARGS) > { >    

[GENERAL] pg_restore 8.x to postgreSQL 9.x functions and triggers aren't created

2010-12-20 Thread Raimon Fernandez
Hello, We have two postgreSQL servers that are in the latest 9.x as testing, but when we use pg_dump and pg_restore, our functions and triggers are never copied to postgreSQL Server 9.x. This is how we restore: data=`date +%Y_%m_%d` pg_restore -c -i -h 192.168.0.9 -p 5432 -U postgres -d global

Re: [GENERAL] pg_restore 8.x to postgreSQL 9.x functions and triggers aren't created [solved]

2010-12-20 Thread Raimon Fernandez
ok, solved. it was a problem with the application that interfaces with pg that has a bug ... sorry, regards, r. On 20dic, 2010, at 09:28 , Raimon Fernandez wrote: > Hello, > > We have two postgreSQL servers that are in the latest 9.x as testing, but > when we use pg_dump and pg_restore, ou

Re: [GENERAL] FTS phrase searches

2010-12-20 Thread Oleg Bartunov
On Sun, 19 Dec 2010, Glenn Maynard wrote: 2010/12/19 Oleg Bartunov : You might be interested in http://www.sai.msu.su/~megera/wiki/2009-08-12 Thanks, that looks pretty much like what I had in mind. Hopefully that'll get merged for 9.0+1; phrases are a major part of all text searches. Sever

[GENERAL] How to guard PostgreSQL from overcharged and/or malicious (read-only) queries?

2010-12-20 Thread Stefan Keller
I'd like to guard postgres from overcharged and/or malicious queries. The queries are strinctly read-only (from a SQL users perspective). For doing this I'd like to code two functions (preferrably pl/pgsql): 1. Filter out all SQL commands which are *not* read-only (no DROP/DELETE/UPDATE/TRUNCATE)

[GENERAL] pg_statsinfo problem

2010-12-20 Thread AI Rumman
Does any one use pg_statsinfo for Postgresql 9.0.1? Is there any similar tools to collect DB Snapshots? I am facing problem during pg_statsinfo configuration. I set as follows: shared_preload_libraries = 'pg_statsinfo,pg_stat_statements' custom_variable_classes = 'pg_statsinfo' But my Db is not s

Re: [GENERAL] pg_statsinfo problem

2010-12-20 Thread Tatsuhito Kasahara
Hi ! > I am facing problem during pg_statsinfo configuration. > I set as follows: > shared_preload_libraries = 'pg_statsinfo,pg_stat_statements' > custom_variable_classes = 'pg_statsinfo' > But my Db is not starting. Which version did you use ? And what log-message were generated ? If you used r

Re: [GENERAL] Maximum size for char or varchar with limit

2010-12-20 Thread Filip Rembiałkowski
2010/12/19 Jasen Betts > I have some values of perhaps 20Mb that I might want to store samples > of in a partitioned table. (so I can delete them easily) what's the right > way? > > 20 Mbits or 20 MBytes? how big samples? answer to your question depends on what you want to do with these samples

Re: [GENERAL] pg_statsinfo problem

2010-12-20 Thread Devrim GÜNDÜZ
On Mon, 2010-12-20 at 19:29 +0900, Tatsuhito Kasahara wrote: > ( I mistook to edit the RPM SPEC file for pg90.rhel5.x86_64... So some > user reported that > "No such files" error was occured when they used the rpm of > pg_statsinfo-2.0.0 with > PG90 on RHEL5.x86_64) Sorry for breaking the thr

Re: [GENERAL] pg_statsinfo problem

2010-12-20 Thread Tatsuhito Kasahara
2010/12/20 Devrim GÜNDÜZ : > Sorry for breaking the thread a bit -- but where is that specfile? I > cannot find it in the tarball. > > Also SRPMs are missing on the website. Now, specfiles and SRPMs are not provided on the pg_statsindo project page.. I'll upload these files ASAP. Best regards, -

Re: [GENERAL] How to guard PostgreSQL from overcharged and/or malicious (read-only) queries?

2010-12-20 Thread Alban Hertroys
On 20 Dec 2010, at 10:05, Stefan Keller wrote: > I'd like to guard postgres from overcharged and/or malicious queries. > > The queries are strinctly read-only (from a SQL users perspective). > For doing this I'd like to code two functions (preferrably pl/pgsql): > > 1. Filter out all SQL command

[GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Raimon Fernandez
Hello, I'm trying to create a plugin using the libpq. Almost everything is working, and now I want to implememt the asynchronous issue. I send the SQL using the PQsendQuery, and my interface is not blocking, great. Now, everytime I check fot the PQgetResult my interface gets blocked. So, now

Re: [GENERAL] Copy From suggestion

2010-12-20 Thread Mark Watson
Thanks, Adrian, I’ll try a windows compile of pgloader sometime during the holidays. It’s true that I already have a solution (export <= 65000 row chunks, import into Excel, export via Excel puts quotes around the text columns), but something faster and more efficient would really help in this cas

Re: [GENERAL] Serial key mismatch in master and slave, while using slony

2010-12-20 Thread Vick Khera
On Sat, Dec 18, 2010 at 7:12 AM, Vishnu S. wrote: > I am using Slony-I slony-I-2.0.2 in windows .I have a master and a slave > machine. The replication is working fine. When the master switches to slave > , there exists a serial key mismatch in master and slave machines. So > insertion fails in th

Re: [GENERAL] Copy From suggestion

2010-12-20 Thread Jorge Godoy
With OpenOffice.org that 65K limit goes away as well... I don't know why it is still like that today for MS Office... It is almost 2011 and they still think 64K is enough? :-) -- Jorge Godoy On Mon, Dec 20, 2010 at 11:49, Mark Watson wrote: > Thanks, Adrian, > > I’ll try a windows compi

Re: [GENERAL] pg_restore 8.x to postgreSQL 9.x functions and triggers aren't created

2010-12-20 Thread Vick Khera
On Mon, Dec 20, 2010 at 3:28 AM, Raimon Fernandez wrote: > when restoring the same file to any of our postgreSQL Servers 8.x we have no > problems. > which version of pg_dump/restore are you using? The one from 8.x or 9.0? Try using the ones from 9.0. -- Sent via pgsql-general mailing list (

Re: [GENERAL] Postgres 9.0 Hiding CONTEXT string in Logs

2010-12-20 Thread Alex -
No reply... I guess its not possible then to switch that off. Hi, I occasionally output information from my PL/Perl functions to show a progres or a debug info like this elog(NOTICE, "Table some_table analyzed"); which generated the NOTICE: Table some_table analyzed however since up

Re: [GENERAL] Copy From suggestion

2010-12-20 Thread Leif Biberg Kristensen
On Monday 20. December 2010 15.24.58 Jorge Godoy wrote: > With OpenOffice.org that 65K limit goes away as well... > > I don't know why it is still like that today for MS Office... It is almost > 2011 and they still think 64K is enough? :-) Maybe there's an uncrippled «Professional» or «Enterpri

[GENERAL] What Programs Do You Use For PG?

2010-12-20 Thread Carlos Mennens
I'm just wondering what programs you guys / girls are using PostgreSQL for. So far I've installed PG 9 on my Debian Linux server and manually created all my databases, schema's, and tables for my personal email / address book. It's very basic and small but I was wondering if you guys know of any pr

Re: [GENERAL] Copy From suggestion

2010-12-20 Thread Adrian Klaver
On Monday 20 December 2010 7:09:23 am Leif Biberg Kristensen wrote: > On Monday 20. December 2010 15.24.58 Jorge Godoy wrote: > > With OpenOffice.org that 65K limit goes away as well... > > > > I don't know why it is still like that today for MS Office... It is > > almost > > > 2011 and they still

[GENERAL] Role Membership

2010-12-20 Thread Carlos Mennens
I was looking at my users and realized none of my users are members of a specific group or role. Not sure if there's a difference between the two (role / group) in PostgreSQL, is there? easports=# \du List of roles Role name |Attributes | Member of -

Re: [GENERAL] Role Membership

2010-12-20 Thread Adrian Klaver
On Monday 20 December 2010 7:27:19 am Carlos Mennens wrote: > I was looking at my users and realized none of my users are members of > a specific group or role. Not sure if there's a difference between the > two (role / group) in PostgreSQL, is there? > > easports=# \du >Lis

Re: [GENERAL] Role Membership

2010-12-20 Thread Carlos Mennens
On Mon, Dec 20, 2010 at 10:41 AM, Adrian Klaver wrote: > Roles = users/groups. In older versions there where users and groups, that has > been consolidated into the concept of a role. If it makes it easier I use the > concept of roles with login privileges as a users and roles without as groups.

Re: [GENERAL] INSERT INTO...RETURNING with partitioned table based on trigger function

2010-12-20 Thread pgsql . 30 . miller_2555
> On 2010-12-16, pgsql(dot)30(dot)miller_2555(at)spamgourmet(dot)com > wrote: > > --0015174c1e4aaf077604977d7e62 > > Content-Type: text/plain; charset=ISO-8859-1 > > > > Hi - > > > > Issue: > > How to return a sequence value generated upon INSERT of records into a > > partitioned table using

Re: [GENERAL] Role Membership

2010-12-20 Thread Scott Marlowe
On Mon, Dec 20, 2010 at 9:12 AM, Carlos Mennens wrote: > So if I wanted to create a group / role for accounting, would I simply just > do: > > CREATE ROLE accounting; > > My question is I can't find: > > 1. How to view all previously created roles on my database. '\dg' > doesn't show me the new r

Re: [GENERAL] Role Membership

2010-12-20 Thread Carlos Mennens
On Mon, Dec 20, 2010 at 12:05 PM, Scott Marlowe wrote: > Odd, mine does.  Got a complete example of creating a role and not seeing it? > > Here's mine: > smarlowe=# create role stans; > CREATE ROLE > smarlowe=# \dg >            List of roles >  Role name |  Attributes  | Member of > ---+--

Re: [GENERAL] Role Membership

2010-12-20 Thread Adrian Klaver
On 12/20/2010 08:12 AM, Carlos Mennens wrote: On Mon, Dec 20, 2010 at 10:41 AM, Adrian Klaver wrote: Roles = users/groups. In older versions there where users and groups, that has been consolidated into the concept of a role. If it makes it easier I use the concept of roles with login privilege

Re: [GENERAL] Postgres 9.0 Hiding CONTEXT string in Logs

2010-12-20 Thread Merlin Moncure
On Mon, Dec 20, 2010 at 10:04 AM, Alex - wrote: > No reply... I guess its not possible then to switch that off. > > > Hi, > I occasionally output information from my PL/Perl functions to show a > progres or a debug info like this > > elog(NOTICE, "Table some_table analyzed"); > > which generated t

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Tom Lane
Raimon Fernandez writes: > Almost everything is working, and now I want to implememt the asynchronous > issue. > I send the SQL using the PQsendQuery, and my interface is not blocking, great. > Now, everytime I check fot the PQgetResult my interface gets blocked. Well, yes. PQgetResult says w

Re: [GENERAL] Role Membership

2010-12-20 Thread Scott Marlowe
On Mon, Dec 20, 2010 at 10:12 AM, Carlos Mennens wrote: > On Mon, Dec 20, 2010 at 12:05 PM, Scott Marlowe > wrote: >> Odd, mine does.  Got a complete example of creating a role and not seeing it? >> >> Here's mine: >> smarlowe=# create role stans; >> CREATE ROLE >> smarlowe=# \dg >>            L

[GENERAL] PostgreSQL Trusted Startup

2010-12-20 Thread Kenneth Buckler
Hello, I am investigating security requirements for configuring a PostgreSQL database on a Linux system. One of the security requirements our organization would like to implement is "trusted startup", in that PostgreSQL would verify the authenticity of the binaries and configuration files before m

Re: [GENERAL] Role Membership

2010-12-20 Thread Carlos Mennens
On Mon, Dec 20, 2010 at 1:32 PM, Scott Marlowe wrote: > No user, no group, they're al roles.  Roles are both / either. Ah now I understand. Thank you! > You grant them that: > > grant rolename to username; > > Then you only ever have to grant / revoke a role to change > permissions, no need to d

Re: [GENERAL] Role Membership

2010-12-20 Thread Adrian Klaver
On Monday 20 December 2010 11:46:29 am Carlos Mennens wrote: > On Mon, Dec 20, 2010 at 1:32 PM, Scott Marlowe wrote: > > No user, no group, they're al roles.  Roles are both / either. > > Ah now I understand. Thank you! > > > You grant them that: > > > > grant rolename to username; > > > > Then y

Re: [GENERAL] PostgreSQL Trusted Startup

2010-12-20 Thread Scott Marlowe
On Mon, Dec 20, 2010 at 12:12 PM, Kenneth Buckler wrote: > Hello, > > I am investigating security requirements for configuring a PostgreSQL > database on a Linux system. > One of the security requirements our organization would like to implement is > "trusted startup", in that PostgreSQL would ver

Re: [GENERAL] PostgreSQL Trusted Startup

2010-12-20 Thread John R Pierce
On 12/20/10 11:12 AM, Kenneth Buckler wrote: Hello, I am investigating security requirements for configuring a PostgreSQL database on a Linux system. One of the security requirements our organization would like to implement is "trusted startup", in that PostgreSQL would verify the authenticit

Re: [GENERAL] PostgreSQL Trusted Startup

2010-12-20 Thread Scott Marlowe
On Mon, Dec 20, 2010 at 1:43 PM, John R Pierce wrote: > I would look into selinux.   lock it down with this, and it will be much > harder to compromise. I agree. By the time you've got compromised binaries / config files on the system, you've already lost. -- Sent via pgsql-general mailing lis

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Raimon Fernandez
On 20dic, 2010, at 18:48 , Tom Lane wrote: >> So, now I'm using the PQisBusy to check if postgre is still busy and I can >> safely call the PQgetResult wihtout blocking, or just wait *some time* >> before sending a new PQisBusy. > > Your proposed code is still a busy-wait loop. This is how ar

Re: [GENERAL] PostgreSQL Trusted Startup

2010-12-20 Thread Kenneth Buckler
On Mon, Dec 20, 2010 at 3:31 PM, Scott Marlowe wrote: > > > But, if the script is run on the same machine as postgresql is on, the > scripts that check for changes could be compromised as well and then > you'd never know. > I agree, if the system has been compromised, nothing will prevent the scr

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Alban Hertroys
On 20 Dec 2010, at 21:49, Raimon Fernandez wrote: > The select(2) that says that are using for wait is this line ? if > (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) { > > I can't see where is 'sleeping' See man 2 select. If you're on an OS without manual pages (Windows is pretty much

Re: [GENERAL] Postgres forums ... take 2

2010-12-20 Thread Thom Brown
On 29 November 2010 04:31, Elliot Chance wrote: > Discussion will continue on the wiki page: > http://wiki.postgresql.org/wiki/Forums_at_postgresql.com.au > > Even though the discussion has moved I still intent to keep pushing the > issues to a resolution. The wiki is not shelving the idea for an

[GENERAL] Setting connection parameters via some kind of client configuration file @ the command line

2010-12-20 Thread Wells Oliver
Hello all- I am using psql from the command line in an Ubuntu environment, and I'd like to setup (if possible) some sort of client configuration for myself that sets some environment variables, mainly client_min_messages. Is there a way to do this? Thanks. -- Wells Oliver Developer, Baseball Syst

Re: [GENERAL] Setting connection parameters via some kind of client configuration file @ the command line

2010-12-20 Thread Adrian Klaver
On Monday 20 December 2010 4:42:57 pm Wells Oliver wrote: > Hello all- I am using psql from the command line in an Ubuntu > environment, and I'd like to setup (if possible) some sort of client > configuration for myself that sets some environment variables, mainly > client_min_messages. Is there a

[GENERAL] Problems With -9.0.1

2010-12-20 Thread Rich Shepard
I built and installed -9.0.1 on my Slackware-13.1 server and it ran for a while. Now, without warning, one of my applications dependent upon postgres won't run. While trying to restart postgres I learned the .pid file did not exist so I removed /tmp/.s.PGSQL* and tried to restart postgres. He

Re: [GENERAL] Problems With -9.0.1

2010-12-20 Thread Adrian Klaver
On Monday 20 December 2010 5:09:24 pm Rich Shepard wrote: >I built and installed -9.0.1 on my Slackware-13.1 server and it ran for > a while. Now, without warning, one of my applications dependent upon > postgres won't run. While trying to restart postgres I learned the .pid > file did not exis

Re: [GENERAL] Problems With -9.0.1

2010-12-20 Thread John R Pierce
On 12/20/10 5:09 PM, Rich Shepard wrote: I built and installed -9.0.1 on my Slackware-13.1 server and it ran for a while. Now, without warning, one of my applications dependent upon postgres won't run. While trying to restart postgres I learned the .pid file did not exist so I removed /tmp/.

Re: [GENERAL] Setting connection parameters via some kind of client configuration file @ the command line

2010-12-20 Thread Scott Marlowe
On Mon, Dec 20, 2010 at 5:42 PM, Wells Oliver wrote: > Hello all- I am using psql from the command line in an Ubuntu environment, > and I’d like to setup (if possible) some sort of client configuration for > myself that sets some environment variables, mainly client_min_messages. Is > there a way

Re: [GENERAL] PostgreSQL Trusted Startup

2010-12-20 Thread Craig Ringer
On 12/21/2010 06:12 AM, Kenneth Buckler wrote: Hello, I am investigating security requirements for configuring a PostgreSQL database on a Linux system. One of the security requirements our organization would like to implement is "trusted startup", in that PostgreSQL would verify the authenticity

Re: [GENERAL] Problems With -9.0.1

2010-12-20 Thread Rich Shepard
On Mon, 20 Dec 2010, Adrian Klaver wrote: As I remember it there was more than one version of Postgres on this machine. Are you sure you are using the correct postgres binary? While I am it is there a reason you are not using the system start scripts or pg_ctl:)? Adrian, There _was_ a libra

Re: [GENERAL] Problems With -9.0.1 [SOLVED]

2010-12-20 Thread Rich Shepard
On Mon, 20 Dec 2010, John R Pierce wrote: if you built and installed postgres in /usr/local/pgsql, then all those errors should have referred to /usr/local/pgsql/share/timezone John, I assumed the reference to share/ was relative to /usr/local/pgsql/ is there a different postgres binary i

Re: [GENERAL] Problems With -9.0.1

2010-12-20 Thread Adrian Klaver
On Monday 20 December 2010 7:12:52 pm Rich Shepard wrote: > On Mon, 20 Dec 2010, Adrian Klaver wrote: > > As I remember it there was more than one version of Postgres on this > > machine. Are you sure you are using the correct postgres binary? While I > > am it is there a reason you are not using t

Re: [GENERAL] Problems With -9.0.1

2010-12-20 Thread Rich Shepard
On Mon, 20 Dec 2010, Adrian Klaver wrote: Well that would be a problem. Still, using pg_ctl would be an improvement. From the docs (http://www.postgresql.org/docs/9.0/interactive/app-pg-ctl.html): "pg_ctl is a utility for initializing a PostgreSQL database cluster, starting, stopping, or restart

[GENERAL] Understanding PG9.0 streaming replication feature

2010-12-20 Thread Ben Carbery
Hi, I am having some trouble trying to figure out how to configure this particular scenario.. I have a pair of pg servers that I want to put in a Master/Standby configuration. Currently a script dumps the master db every hour, copies it to the standby, restores, and restarts the server. The aim i

Re: [GENERAL] What Programs Do You Use For PG?

2010-12-20 Thread Neil D'Souza
You can have a look at my project on sourceforge: http://sourceforge.net/projects/proghelp builds applications with PG as a backend automatically. It uses a modified create table sql grammar as an input. 1. It automatically generates stored procedures to insert and retrieve data 2. a database api

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Raimon Fernandez
On 21dic, 2010, at 00:56 , Alban Hertroys wrote: > On 20 Dec 2010, at 21:49, Raimon Fernandez wrote: > >> The select(2) that says that are using for wait is this line ? if >> (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) { >> >> I can't see where is 'sleeping' > > > See man 2 select.