[GENERAL] PD_ALL_VISIBLE flag warnings

2011-08-12 Thread MirrorX
hello to all, the last few days i have observed tons of msgs like the above on a db server of ours. i have searched a lot on the internet but didn't find much relevant information. i read that this could mean some kind of serious data corruption, but didn't find more info in this direction. on the

[GENERAL] How to create a stored procedure in PostgreSQL

2011-08-12 Thread Siva Palanisamy
Hi All, I have worked in MS SQL Server where we can create a stored procedure that performs some set of queries in tandem. I wish to see a similar feature in PostgreSQL. Please guide me. I searched and found only functions as replacement to stored procedure in PostgreSQL! Is that so? How functi

Re: [GENERAL] How to create a stored procedure in PostgreSQL

2011-08-12 Thread Craig Ringer
On 12/08/2011 4:22 PM, Siva Palanisamy wrote: Hi All, I have worked in MS SQL Server where we can create a stored procedure that performs some set of queries in tandem. I wish to see a similar feature in PostgreSQL. Please guide me. I searched and found only functions as replacement to stored p

Re: [GENERAL] How to create a stored procedure in PostgreSQL

2011-08-12 Thread Siva Palanisamy
Hi Craig, Thanks a lot for your detailed response. Regards, Siva. -Original Message- From: Craig Ringer [mailto:ring...@ringerc.id.au] Sent: Friday, August 12, 2011 2:14 PM To: Siva Palanisamy Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] How to create a stored procedure in Po

Re: [GENERAL] PD_ALL_VISIBLE flag warnings

2011-08-12 Thread MirrorX
i wiil provide some info in case it is helpful -the error msg is -> WARNING: PD_ALL_VISIBLE flag was incorrectly set in relation "summary_data" page 54 (the same thing appears for many tables and many pages on each table) -in my internet searching i found some cases where this issue was related

Re: [GENERAL] PD_ALL_VISIBLE flag warnings

2011-08-12 Thread Craig Ringer
On 12/08/2011 4:13 PM, MirrorX wrote: hello to all, the last few days i have observed tons of msgs like the above on a db server of ours. Please include the full text of the error from the server logs. the server is 8.4.7. i dont know what kind of information i could provide to you, in order t

Re: [GENERAL] PD_ALL_VISIBLE flag warnings

2011-08-12 Thread Adrian Klaver
On Friday, August 12, 2011 2:01:19 am MirrorX wrote: > i wiil provide some info in case it is helpful > > -the error msg is -> WARNING: PD_ALL_VISIBLE flag was incorrectly set in > relation "summary_data" page 54 > (the same thing appears for many tables and many pages on each table) > > -in my

[GENERAL] How to convert integer to string in functions

2011-08-12 Thread Siva Palanisamy
Hi All, In my table, some of the columns are in text datatype. Few data will come down from UI layer as integers. I want to convert that to string/text before saving it into the table. Please help me on this. Thanks and Regards, Siva. ::DISCLAIMER:: --

Re: [GENERAL] How to convert integer to string in functions

2011-08-12 Thread David Johnston
> In my table, some of the columns are in text datatype. Few data will come > down from UI layer as integers. I want to convert that to string/text before > saving it into the table. Please help me on this. > SQL Standard: "CAST( value AS text )" [or varchar] PostgreSQL short-hand: "value::te

Re: [GENERAL] How to convert integer to string in functions

2011-08-12 Thread Adrian Klaver
On Friday, August 12, 2011 6:53:57 am Siva Palanisamy wrote: > Hi All, > > In my table, some of the columns are in text datatype. Few data will come > down from UI layer as integers. I want to convert that to string/text > before saving it into the table. Please help me on this. Should not need t

Re: [GENERAL] COPY from .csv File and Remove Duplicates

2011-08-12 Thread Rich Shepard
On Thu, 11 Aug 2011, David Johnston wrote: If you have duplicates with matching real keys inserting into a staging table and then moving new records to the final table is your best option (in general it is better to do a two-step with a staging table since you can readily use Postgresql to perfo

Re: [GENERAL] COPY from .csv File and Remove Duplicates

2011-08-12 Thread David Johnston
> A pointer to the appropriate syntax for retrieving the entire row when > count(loc_name, sample_date, param) > 1 would be much appreciated. > > Rich > Select * From table Natural Inner join ( SELECT loc_name, sample_date, param, Count(*) as duplicate_count FROM table Group by loc_name, sampl

[GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread George MacKerron
Hi all. I have a function returning setof record. The name of a table it acts on is one of its input variables, and its output is a set of rows from that table. E.g. for simplicity, imagine it's this pointless function: create or replace function select_all_from(table_name text) returns setof

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread Raymond O'Donnell
On 12/08/2011 17:04, George MacKerron wrote: > Hi all. > > I have a function returning setof record. The name of a table it acts > on is one of its input variables, and its output is a set of rows > from that table. E.g. for simplicity, imagine it's this pointless > function: > > create or replac

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread George MacKerron
Many thanks for the reply, Ray. Unfortunately, I don't think this addresses the problem, because I'd hoped not to have to hard-code the table name into the function. The point of the function is that you can pass it any table name (along with some other parameters) and it returns rows from tha

Re: [GENERAL] COPY from .csv File and Remove Duplicates

2011-08-12 Thread Rich Shepard
On Fri, 12 Aug 2011, David Johnston wrote: Select * From table Natural Inner join ( SELECT loc_name, sample_date, param, Count(*) as duplicate_count FROM table Group by loc_name, sample_date, param ) grouped Where duplicate_count > 1 ; David, Thank you. I was close in my attempts, but not s

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread Merlin Moncure
On Fri, Aug 12, 2011 at 11:26 AM, George MacKerron wrote: > Many thanks for the reply, Ray. > > Unfortunately, I don't think this addresses the problem, because I'd hoped > not to have to hard-code the table name into the function. > > The point of the function is that you can pass it any table n

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread Raymond O'Donnell
On 12/08/2011 17:26, George MacKerron wrote: > Many thanks for the reply, Ray. > > Unfortunately, I don't think this addresses the problem, because I'd > hoped not to have to hard-code the table name into the function. > > The point of the function is that you can pass it any table name > (along

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread Rob Sargent
On 08/12/2011 10:04 AM, George MacKerron wrote: > Hi all. > > I have a function returning setof record. The name of a table it acts on is > one of its input variables, and its output is a set of rows from that table. > E.g. for simplicity, imagine it's this pointless function: > > create or repla

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread George MacKerron
On 12 Aug 2011, at 17:43, Merlin Moncure wrote: > you can't have it both ways. at the time the function call is > executed, the return type/fields must be known. you can do this by > either a. explicitly defining the function return type or b. > describing the function return type in the function

Re: [GENERAL] COPY from .csv File and Remove Duplicates

2011-08-12 Thread Rich Shepard
On Fri, 12 Aug 2011, David Johnston wrote: Select * From table Natural Inner join ( SELECT loc_name, sample_date, param, Count(*) as duplicate_count FROM table Group by loc_name, sample_date, param ) grouped Where duplicate_count > 1; Tried to use the above in an INSERT INTO statement to a c

Re: [GENERAL] Functions returning setof record -- can I use a table type as my return type hint?

2011-08-12 Thread Merlin Moncure
On Fri, Aug 12, 2011 at 12:01 PM, George MacKerron wrote: > On 12 Aug 2011, at 17:43, Merlin Moncure wrote: > >> you can't have it both ways. at the time the function call is >> executed, the return type/fields must be known.  you can do this by >> either a. explicitly defining the function return

Re: [GENERAL] COPY from .csv File and Remove Duplicates

2011-08-12 Thread David Johnston
INSERT INTO chem_too (lab_nbr, loc_name, sample_date, param, quant, units, qa_qc, easting, northing, remark) SELECT * FROM chemistry Natural Inner join ( SELECT loc_name, sample_date, param, Count(*) as duplicate_count FROM chemistry GROUP BY loc_name, sample_date, param) group

Re: [GENERAL] PD_ALL_VISIBLE flag warnings

2011-08-12 Thread Tom Lane
MirrorX writes: > the last few days i have observed tons of msgs like the above on a db server > of ours. i have searched a lot on the internet but didn't find much relevant > information. > the server is 8.4.7. These are almost certainly not something to worry about. See this 8.4.8 patch: htt

[GENERAL] Kudos

2011-08-12 Thread George Weaver
Hi Everyone, I want to thank all those that contribute to the PostgeSQL project for such an awesome and professional product. I started working with 7.2 on Windows (via cygwin), then 7.3, then to 8 and 8.1. I have been using the 8.3 branch since it first came out. This week I downloaded 9.

Re: [GENERAL] Postgres on SSD

2011-08-12 Thread Vick Khera
2011/8/10 Ondrej Ivanič : > Ups! Well spotted Tomas! The actual values are: > random_page_cost = 2 > seq_page_cost = 1 > With the SSD I would set these to the same value of 1. That's what I do. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscri

Re: [GENERAL] Indicating DEFAULT values in INSERT statement

2011-08-12 Thread Vincent Veyron
Le mardi 09 août 2011 à 15:57 -0700, Postgres User a écrit : > > > From a db function, I'd like to force the use of default when an input > parameter is null. May be something like this : CREATE TABLE users ( id bigint NOT NULL, username text NOT NULL, is_active boolean DEFAULT

Re: [GENERAL] Indicating DEFAULT values in INSERT statement

2011-08-12 Thread Vincent Veyron
Le mardi 09 août 2011 à 15:57 -0700, Postgres User a écrit : > > > From a db function, I'd like to force the use of default when an input > parameter is null. May be something like this : CREATE TABLE users ( id serial NOT NULL, username text NOT NULL, is_active boolean DEFAULT

Re: [GENERAL] Postgres on SSD

2011-08-12 Thread Greg Smith
On 08/12/2011 04:24 PM, Vick Khera wrote: 2011/8/10 Ondrej Ivanič: Ups! Well spotted Tomas! The actual values are: random_page_cost = 2 seq_page_cost = 1 With the SSD I would set these to the same value of 1. That's what I do. That probably makes sense on your RAMSAN. Sequent

Re: [GENERAL] Kudos

2011-08-12 Thread Andy Colson
On 8/12/2011 3:12 PM, George Weaver wrote: Hi Everyone, I want to thank all those that contribute to the PostgeSQL project for such an awesome and professional product. I started working with 7.2 on Windows (via cygwin), then 7.3, then to 8 and 8.1. I have been using the 8.3 branch since it fi

Re: [GENERAL] COPY from .csv File and Remove Duplicates [RESOLVED]

2011-08-12 Thread Rich Shepard
On Fri, 12 Aug 2011, David Johnston wrote: Thus, you need to replace the "*" in the SELECT with the specific columns that correspond to the columns listed in to INSERT portion of the query. David, Mea culpa! I should have seen this myself. Now the query works and I have about 6K duplicate p

[GENERAL] Bit-Strings - Is there a more succinct way to do this?

2011-08-12 Thread David Johnston
Making use of my first Bit-String and need see which records in a table have at least one position match with a user-supplied comparison string. The following query is what I am using to do the comparison. SELECT * FROM (VALUES (B'010',B'01000')) src (vs_bitmap_stock, vs_bitmap_sale) WHERE