Re: [GENERAL] SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?

2010-03-02 Thread Harvey, Allan AC
> I do not know how to really describe this... > > In pascal I would do > > If (AField and Flag3)=Flag3 then ... > > Checking to see if AField contains the BIT(s) FLAG3 is set to... is > there a way to do this in a SELECT statement -- select * from ATable > where AField and 0x0004=0x

Re: [GENERAL] Trigger help - updates to column data with null values

2010-03-02 Thread Greg Fischer
NICE!!! Worked beautifully! I figured NULL's were not evaluating as a value, but I didn't have the correct operators: these constructs effectively act as though null were a normal data value, > rather than “unknown”. I guess I wasn't reading the right part of the manuals! LOL! Thanks so much!

Re: [GENERAL] Trigger help - updates to column data with null values

2010-03-02 Thread Craig Ringer
Greg Fischer wrote: > Hello all! > I do my best to read and google my way around issues, but I seem to be > missing something. Probably simple too. > > So I have a trigger function, in which I'd like to check if a particular > column has changed. It works great, unless either the OLD or NEW value

[GENERAL] Trigger help - updates to column data with null values

2010-03-02 Thread Greg Fischer
Hello all! I do my best to read and google my way around issues, but I seem to be missing something. Probably simple too. So I have a trigger function, in which I'd like to check if a particular column has changed. It works great, unless either the OLD or NEW values are NULL. The purpose is to c

Re: [GENERAL] [SOLVED] SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?

2010-03-02 Thread Ozz Nixon
Figured it out: ./sql -S=10.1.10.232 PostgreSQL v8.x Compatible SQL Command Line Tool by 3F, LLC (www.3flabs.com ) SQL> select * from bffcomwiki where flags & 8 != 0; pagename = = = = = = Welcome 1 records found i

[GENERAL] SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?

2010-03-02 Thread Ozz Nixon
I do not know how to really describe this... In pascal I would do If (AField and Flag3)=Flag3 then ... Checking to see if AField contains the BIT(s) FLAG3 is set to... is there a way to do this in a SELECT statement -- select * from ATable where AField and 0x0004=0x0004 ? Thanks,

Re: [GENERAL] disable triggers isolated to transaction only?

2010-03-02 Thread Tom Lane
Vick Khera writes: > My question is this: will ALTER TABLE ONLY $subtable DISABLE TRIGGER > ALL within a transaction only affect my transaction, or will it affect > anyone inserting into this subtable. If it blocks external inserts > that's ok since my transactions are small while moving the data

[GENERAL] Not all functions in schema pg_catalog are "visible"

2010-03-02 Thread Thomas Kellerer
Hi, I just noticed that that there are functions defined (such as pg_catalog.time(timestamp) that can only be called when prefixed with pg_catalog. However other functions (that are at first glance defined identically to time()) can be called without prefixing them with pg_catalog. My underst

Re: [GENERAL] FSM and VM file

2010-03-02 Thread akp geek
I am doing a replication of one of the database and the size of the slave database is growing exponentially . Right now the size of master db is 849M and the slave is 7GB. When I noticed the base directory on the slave , that's when I noticed the fsm and vm files and raised the question. is there

Re: [GENERAL] FSM and VM file

2010-03-02 Thread Scott Mead
Those are the free space map / visibility map files. There is going to be one of each for every relation. No worries :-) They are supposed to be there: http://wiki.postgresql.org/wiki/Segment_Visibility_Map Don't clean them up, doing so could be disastrous. Actually, if I were you, I wo

Re: [GENERAL] FSM and VM file

2010-03-02 Thread Thomas Kellerer
akp geek wrote on 02.03.2010 22:11: Hi all - There are lot of FSM and VM files getting generated in the base directory. Do we need these files and I don't know the reason why these files are getting generated. I read the documentation, but not able to follow well. I will read it ag

[GENERAL] FSM and VM file

2010-03-02 Thread akp geek
Hi all - There are lot of FSM and VM files getting generated in the base directory. Do we need these files and I don't know the reason why these files are getting generated. I read the documentation, but not able to follow well. I will read it again. But do we need to keep these file

[GENERAL] Re: [ADMIN] The OS Command for pg_hotbackup -- Use lvmsnapshot instead of tar cvzf

2010-03-02 Thread Scott Marlowe
On Tue, Mar 2, 2010 at 12:20 PM, Scott Marlowe wrote: > On Tue, Mar 2, 2010 at 8:43 AM, Arnold, Sandra wrote: >> I am currently using the pg_hotbackup Perl script to backup my production >> PostgreSQL database.  However, the next production database is going to be >> close to a terrabyte in size.

[GENERAL] Re: [ADMIN] The OS Command for pg_hotbackup -- Use lvmsnapshot instead of tar cvzf

2010-03-02 Thread Scott Marlowe
FYI, here's the conversations on the subject of LVM and write barriers from last year about this time: http://www.redhat.com/archives/linux-lvm/2009-March/msg00025.html http://archives.postgresql.org/pgsql-general/2009-03/msg00204.php Note that it's also considered bad form to post the same quest

[GENERAL] Re: [ADMIN] The OS Command for pg_hotbackup -- Use lvmsnapshot instead of tar cvzf

2010-03-02 Thread Scott Marlowe
On Tue, Mar 2, 2010 at 8:43 AM, Arnold, Sandra wrote: > I am currently using the pg_hotbackup Perl script to backup my production > PostgreSQL database.  However, the next production database is going to be > close to a terrabyte in size.  We feel that a tar cvzf command is not the > correct OS ba

Re: [GENERAL] disable triggers isolated to transaction only?

2010-03-02 Thread Ben Chobot
On Mar 2, 2010, at 9:48 AM, Vick Khera wrote: > I guess at worse I lock the table. Before you go there, assuming you cannot just disable a trigger for a session, then depending on how many counters your insert trigger modifies, it might be better to simply undo the trigger's effects in the sa

Re: [GENERAL] Array columns vs normalized table

2010-03-02 Thread Lee Hachadoorian
Pavel, the idea of using arrays to store long time-series data sounds good, but I take your point that normalized tables might be better and are easier to query. I suppose the choice will be between normalizing or using the denormalized industry int, year    smallint, emp_q1  int, emp_q2  int, emp

[GENERAL] createdb but revoke dropdb

2010-03-02 Thread Ben Eliott
Hi, In using 8.3. I'm trying to set up programmatic database creation but is there a way that the user creating the databases can be restricting from dropping them? I have two roles, 'adminuser' with createdb permission, and 'dbuser' a user with CRUD privileges. adminuser is a member of

[GENERAL] Re: [ADMIN] The OS Command for pg_hotbackup -- Use lvmsnapshot instead of tar cvzf

2010-03-02 Thread Chander Ganesan
Arnold, Sandra wrote: I am currently using the pg_hotbackup Perl script to backup my production PostgreSQL database. However, the next production database is going to be close to a terrabyte in size. We feel that a tar cvzf command is not the correct OS backup solution to use. Instead we wo

Re: [GENERAL] Array columns vs normalized table

2010-03-02 Thread Scott Bailey
Lee Hachadoorian wrote: I work with state labor data which is reported to us in the form industry, year, quarter1, quarter2, quarter3, quarter4 where each quarter represents an employment count. Obviously, this can be normalized to industry, year, quarter, employment Can anyon

Re: [GENERAL] Array columns vs normalized table

2010-03-02 Thread Peter Hunsberger
On Tue, Mar 2, 2010 at 11:21 AM, Lee Hachadoorian wrote: > I work with state labor data which is reported to us in the form > >        industry, year, quarter1, quarter2, quarter3, quarter4 > > where each quarter represents an employment count. Obviously, this can > be normalized to > >        ind

Re: [GENERAL] Array columns vs normalized table

2010-03-02 Thread Pavel Stehule
Hello 2010/3/2 Lee Hachadoorian : > I work with state labor data which is reported to us in the form > >        industry, year, quarter1, quarter2, quarter3, quarter4 > > where each quarter represents an employment count. Obviously, this can > be normalized to > >        industry, year, quarter, e

Re: [GENERAL] tipo de dato

2010-03-02 Thread Said Ramirez
Miguel, Tenras mas exito si haces tus preguntas en la lista en espanol : pgsql-es-ay...@postgresql.org ya que ahi la majoria de la gente habla ingles y no espanol -Said Said Ramirez Miguel Angel Hernandez Moreno wrote: disculpen alguien tiene o sabe de algun documento que me pueda ayudar

[GENERAL] disable triggers isolated to transaction only?

2010-03-02 Thread Vick Khera
I'm planning to split a large table into partitions. During the migration, all new data will be added to the sub-tables, and I will be moving the data from the master table to the proper sub tables at the same time. The trick is that I have an INSERT trigger to keep track of various counters. I

[GENERAL] Array columns vs normalized table

2010-03-02 Thread Lee Hachadoorian
I work with state labor data which is reported to us in the form industry, year, quarter1, quarter2, quarter3, quarter4 where each quarter represents an employment count. Obviously, this can be normalized to industry, year, quarter, employment Can anyone comment on, or point to

Re: [GENERAL] to_timestamp() and quarters

2010-03-02 Thread Scott Bailey
Tom Lane wrote: Asher Hoskins writes: I can't seem to get to_timestamp() or to_date() to work with quarters, The source code says * We ignore Q when converting to date because it is not * normative. * * We still parse the so

[GENERAL] tipo de dato

2010-03-02 Thread Miguel Angel Hernandez Moreno
disculpen alguien tiene o sabe de algun documento que me pueda ayudar para defender la idea de que los tipos de datos si afectan en la velocidad de una consulta por ejemplo. tengo un tipo de dato timestamp y un numerico y lo que quiero dar a entender es que una consulta con un numerico con un ti

[GENERAL] I suspend the subscription

2010-03-02 Thread maria teresa tarquino
quiero salir o supender la suscripción.. gracias I suspend the subscription ¡Obtén la mejor experiencia en la web! Descarga gratis el nuevo Internet Explorer 8. http://downloads.yahoo.com/ieak8/?l=

[GENERAL] The OS Command for pg_hotbackup -- Use lvmsnapshot instead of tar cvzf

2010-03-02 Thread Arnold, Sandra
I am currently using the pg_hotbackup Perl script to backup my production PostgreSQL database. However, the next production database is going to be close to a terrabyte in size. We feel that a tar cvzf command is not the correct OS backup solution to use. Instead we would like to use lvmsnaps

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Said Ramirez
if you don't want to search the archives, it could just be easier to look at the catalog tables yourself. If you have no experience with them, many times if you do pg_foo when you are interested in 'foo' you will get something, i.e pg_user also exists. #\d pg_tables View "pg_catalog.pg_tables"

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Antonio Goméz Soto
Op 02-03-10 16:14, Raymond O'Donnell schreef: On 02/03/2010 14:56, Thom Brown wrote: But I still need to define access to each table separately? Thanks, Antonio. As far as I'm aware. It's only in the upcoming version 9.0 that you can do things like: GRANT SELECT ON ALL TABLES IN SCHEMA pu

Re: [GENERAL] to_timestamp() and quarters

2010-03-02 Thread A. Kretschmer
In response to Tom Lane : > Asher Hoskins writes: > > I can't seem to get to_timestamp() or to_date() to work with quarters, > > The source code says > > * We ignore Q when converting to date because it is not > * normative. > * >

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Raymond O'Donnell
On 02/03/2010 14:56, Thom Brown wrote: >> >> But I still need to define access to each table separately? >> >> Thanks, >> Antonio. >> > > As far as I'm aware. It's only in the upcoming version 9.0 that you > can do things like: > > GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; > > Ot

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Thom Brown
On 2 March 2010 14:49, Antonio Goméz Soto wrote: > Op 02-03-10 13:00, Thom Brown schreef: >> >> On 2 March 2010 11:46, Nilesh Govindarajan  wrote: >>> >>> On Tue, Mar 2, 2010 at 4:57 PM, Thom Brown  wrote: On 2 March 2010 11:12, Antonio Goméz Soto wrote: > > Hi, > >

Re: [GENERAL] to_timestamp() and quarters

2010-03-02 Thread Tom Lane
Asher Hoskins writes: > I can't seem to get to_timestamp() or to_date() to work with quarters, The source code says * We ignore Q when converting to date because it is not * normative. * * We still parse the source string for a

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Antonio Goméz Soto
Op 02-03-10 13:00, Thom Brown schreef: On 2 March 2010 11:46, Nilesh Govindarajan wrote: On Tue, Mar 2, 2010 at 4:57 PM, Thom Brown wrote: On 2 March 2010 11:12, Antonio Goméz Soto wrote: Hi, I tried this: names=# grant select on database names to spice; ERROR: invalid privilege type SEL

Re: [GENERAL] need a query

2010-03-02 Thread Pavel Stehule
2010/3/2 AI Rumman : > I have data as followos: > > Table: contact > column: phone as varchar >  +1 (800) 863-3950 ext. 517 > +1.510.291.6100 ext2347 >  +1.714.545.8886 ext 144 > 714.545.8887 ext 144 > 714.545.8898 > +1.510.291.6101 > > I need to extract only the phone numbers using a SQL query lik

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Craig Ringer
On 2/03/2010 8:00 PM, Thom Brown wrote: CREATE ROLE testuser WITH LOGIN; -- At this point we haven't assigned this user to any group SET ROLE testuser; SELECT * FROM table_a; We get: ERROR: permission denied for relation table_a ... if table_a doesn't have grants to public, which it may wel

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Thom Brown
On 2 March 2010 11:46, Nilesh Govindarajan wrote: > On Tue, Mar 2, 2010 at 4:57 PM, Thom Brown wrote: >> >> On 2 March 2010 11:12, Antonio Goméz Soto >> wrote: >> > Hi, >> > >> > I tried this: >> > >> > names=# grant select on database names to spice; >> > ERROR:  invalid privilege type SELECT f

[GENERAL] need a query

2010-03-02 Thread AI Rumman
I have data as followos: Table: contact column: phone as varchar +1 (800) 863-3950 ext. 517 +1.510.291.6100 ext2347 +1.714.545.8886 ext 144 714.545.8887 ext 144 714.545.8898 +1.510.291.6101 I need to extract only the phone numbers using a SQL query like: +1 (800) 863-3950 ext. 517 --- 80

Re: [GENERAL] custom index

2010-03-02 Thread Simon Riggs
On Mon, 2010-03-01 at 14:52 +0100, michael uwe maier wrote: > i want to develop an index for a special problem. > The postgres docs shows the necessary bits in > http://www.postgresql.org/docs/8.4/interactive/indexam.html > especially paragraph 50.2 "Index Access Method Functions". > >

Re: [GENERAL] Putting index entries to XLog

2010-03-02 Thread Simon Riggs
On Thu, 2010-02-25 at 12:41 +0100, Carsten Kropf wrote: > I have encountered a problem while implementing an index structure. I don't > have any access to the RM (I don't know, how to set it up properly) using my > index. However, when I don't have the situation of working with a temporary > ta

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Nilesh Govindarajan
On Tue, Mar 2, 2010 at 4:57 PM, Thom Brown wrote: > On 2 March 2010 11:12, Antonio Goméz Soto > wrote: > > Hi, > > > > I tried this: > > > > names=# grant select on database names to spice; > > ERROR: invalid privilege type SELECT for database > > > > The documentation seems to imply I need to

Re: [GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Thom Brown
On 2 March 2010 11:12, Antonio Goméz Soto wrote: > Hi, > > I tried this: > > names=# grant select on database names to spice; > ERROR:  invalid privilege type SELECT for database > > The documentation seems to imply I need to grant SELECT > to each table separately. That's a lot of work, and what

[GENERAL] How to grant a user read-only access to a database?

2010-03-02 Thread Antonio Goméz Soto
Hi, I tried this: names=# grant select on database names to spice; ERROR: invalid privilege type SELECT for database The documentation seems to imply I need to grant SELECT to each table separately. That's a lot of work, and what if new tables are created? Thanks, Antonio -- Sent via pgsql-g

[GENERAL] to_timestamp() and quarters

2010-03-02 Thread Asher Hoskins
Hello. I can't seem to get to_timestamp() or to_date() to work with quarters, can anyone see what I'm doing wrong? e.g. select to_date('2010-1', '-Q'); Gives "2010-01-01" (correct). select to_date('2010-3', '-Q'); Also gives "2010-01-01" (should be 2010

Re: [GENERAL] Hung postmaster (8.3.9)

2010-03-02 Thread Greg Stark
We should probably also check and prohibit including directories as files. On Tuesday, March 2, 2010, Tom Lane wrote: > In the meantime, it seems like we ought to take two defensive steps: -- greg -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your