[GENERAL] stored proc - how to format numbers?

2011-09-21 Thread J.V.
In PostgreSQL (9.x), I have a variable that I want to format with commas. I do not know how many digits will be in the number, it could be an int (2Billion+) or a BigInt (18 digits or more). All I simply want to do is to use: to_number( and have the commas put in before display. There are

[GENERAL] stored procs

2011-09-28 Thread J.V.
need to extract this meta-data for a project. Regards, J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] stored proc

2011-09-28 Thread J.V.
e on this does not show any examples. Also where can I find a list of stored proc data structures (hash maps, arrays, lists of arrays) or anything else that would be useful. thanks J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] stored procs

2011-09-30 Thread J.V.
Yes, I know that one. What I want to do however is within a stored procedure make a call and store all tables in a given schema in a list. Is this something you can answer? thanks J.V. On 9/29/2011 3:25 AM, Richard Huxton wrote: On 29/09/11 02:33, J.V. wrote: Is is possible within a

[GENERAL] stored procedures (packages)

2011-09-30 Thread J.V.
I need to run a series of stored procedures, what is the best way to organize and run. Ideally would like something like Oracle PL/SQL where I can put all methods in one file and create a main() method then just : select main() to have them all run. If there is a way to do this, please let

[GENERAL] stored procs / data types

2011-09-30 Thread J.V.
What data types do I have access to in a stored proc? I cannot seem to find the stored procedure manual. I am not speaking of database field/column data types, but rather stored proc data types. Regards, J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] stored procs

2011-09-30 Thread J.V.
no "CREATE SEQUENCE" would be needed. thanks J.V. On 9/30/2011 2:45 AM, John R Pierce wrote: create table yyy (id serial primary key, xxx_id int references xxx(id)); -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.pos

[GENERAL] stored function (possible to access file system or call java program)?

2011-10-03 Thread J.V.
Is it possible within a stored function to: 1) Access the file system (to rename a file for example) 2) Call a java program thanks J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

[GENERAL] table sequence, renumbering

2011-10-04 Thread J.V.
;s in the end, but want a stored proc to simple reorder a primary key int column pulling from a named sequence, if there is a single command. thanks J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mai

[GENERAL] how to disable all pkey/fkey constraints globally

2011-10-04 Thread J.V.
assuming the reverse could not be done because would have to re-create each one individually? Maybe I do not want to drop, so is there a way to simply disable all globally (not drop) & then enable all globally? thanks J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

[GENERAL] fail: alter table NOCHECK CONSTRAINT ALL;

2011-10-04 Thread J.V.
to disable all existing constraints on all tables everywhere (specifically all pkey & fkey constraints irrespective of how they were created) in one statement? I have searched and searched and find nothing that works. J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresq

[GENERAL] how to select one column into another in same table?

2011-10-04 Thread J.V.
the same table and to have it execute much more quickly that the two statements currently do. thanks J.V. -- 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] fail: alter table NOCHECK CONSTRAINT ALL;

2011-10-04 Thread J.V.
Is there a way to disable all "trigger user' in one statement? (and then re-enable?) One docs says primary keys and foreign keys are "user triggers" thanks J.V. On 10/4/2011 1:12 PM, Guillaume Lelarge wrote: Not sure where you look up, but there's no way

Re: [GENERAL] how to select one column into another in same table?

2011-10-04 Thread J.V.
constraint). J.V. On 10/4/2011 1:09 PM, Scott Marlowe wrote: On Tue, Oct 4, 2011 at 12:24 PM, J.V. wrote: Currently I can select one column into another with two statements: alter table add column id_old int; update set id_old = id; Is there a way to do this in one statement with a select

[GENERAL] how to save primary key constraints

2011-10-11 Thread J.V.
table name and the primary key field. Regards, J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] how to find primary key field name?

2011-10-11 Thread J.V.
but given the table_name and the constraint_name, how do I find the database column/field name associated with that primary key? J.V. -- 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] how to save primary key constraints

2011-10-11 Thread J.V.
pg_catalog table does not exist. This is a solution for PostgreSQL 8.4. If you know of a way I can get all primary key fields or have a query that will work in 8.4, please help. I have done a lot of research and cannot find a simple way. J.V. On 10/11/2011 3:29 PM, John R Pierce wrote

[GENERAL] how to key/value iterate in stored function

2011-10-12 Thread J.V.
there is no clear example or documentation. The key and the value would be text. I want to iterate over the entire array (or list), so would need an example on that or some pointers there, if there is help. J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] how to key/value iterate in stored function

2011-10-12 Thread J.V.
I tried hstore with no luck. How do I initialize the array? How do I loop through each key/value pair in a stored function to retrieve the key and value for each item in the list? I need a list of key value pairs. Any options there? J.V. On 10/12/2011 8:51 AM, Merlin Moncure wrote: On

[GENERAL] how to list or array of key value pairs

2011-10-12 Thread J.V.
function. that's all any ideas? J.V. -- 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] how to key/value iterate in stored function

2011-10-12 Thread J.V.
1:11 PM, David Johnston wrote: On Oct 12, 2011, at 14:43, "J.V." wrote: I tried hstore with no luck. How do I initialize the array? How do I loop through each key/value pair in a stored function to retrieve the key and value for each item in the list? I need a list of key value p

Re: [GENERAL] how to list or array of key value pairs

2011-10-14 Thread J.V.
examples out there, it would be greatly appreciated. Sincerely, J.V. On 10/13/2011 2:18 AM, Sergey Konoplev wrote: Probably this will help you http://www.postgresql.org/docs/current/interactive/hstore.html ps. Look at the each() function. On 12 October 2011 22:45, J.V. wrote: I need to

[GENERAL] how to for loop with distinct values?

2012-05-21 Thread J.V.
* I am banging my head over this. I want to select distinct values from a varchar column and iterate through the values. * *I want to select the distinct values from this column and loop through them (using as a variable) in a raise notice statement and also in an update statement. I have n

[GENERAL] a set of key/value pairs

2011-10-20 Thread J.V.
not point me to this doc: http://developer.postgresql.org/pgdocs/postgres/hstore.html What I am looking for is an example as listed in 1..3 above, and that is not provided in the doc. Regards, J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] how to disable all pkey/fkey constraints globally

2011-10-20 Thread J.V.
[mailto:pgsql-general- ow...@postgresql.org] On Behalf Of J.V. Sent: Tuesday, October 04, 2011 10:00 PM To: pgsql-general Subject: [GENERAL] how to disable all pkey/fkey constraints globally Is there a generic way to drop just all primary key and foreign key constraints on a given table? I know

[GENERAL] PostgreSQL uninstall fails

2011-11-10 Thread J.V.
o get this fixed and go back and patch everything from 8.4 forwards so that it is fixed. It is very time consuming for me to do 1..3 and I am sure others as well and I want to get this fixed as soon as I can. Regards, J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.or

Re: [GENERAL] PostgreSQL uninstall fails

2011-11-10 Thread J.V.
matching the pattern '*postgres*' 2. that has a directory value matching the pattern '*postgres*' 3. that has a key name matching the pattern '*postgres*' thanks J.V. On 11/10/2011 2:36 PM, John R Pierce wrote: On 11/10/11 1:30 PM, J.V. wrote: Can any

[GENERAL] how to drop function?

2011-11-15 Thread J.V.
How do I drop a function that was created like so: create or replace function process_table (action TEXT, v_table_name varchar(100)) RETURNS BOOLEAN AS $$ DECLARE BEGIN ... END; $$ LANGUAGE plpgsql; --- I have tried various ways, but it always fails. J.V. -- Sent via pgsql-general

Re: [GENERAL] how to drop function?

2011-11-15 Thread J.V.
this did not work. On 11/15/2011 4:56 PM, Craig Ringer wrote: On 11/16/2011 07:38 AM, J.V. wrote: How do I drop a function that was created like so: create or replace function process_table (action TEXT, v_table_name varchar(100)) RETURNS BOOLEAN AS $$ DECLARE BEGIN ... END; $$ LANGUAGE

Re: [GENERAL] how to drop function?

2011-11-15 Thread J.V.
this does not work. On 11/15/2011 4:56 PM, Rebecca Clarke wrote: DROP FUNCTION process_table; should work. On Tue, Nov 15, 2011 at 11:38 PM, J.V. <mailto:jvsr...@gmail.com>> wrote: How do I drop a function that was created like so: create or replace function process_tabl

Re: [GENERAL] how to drop function?

2011-11-15 Thread J.V.
r a single param. It seems to get hung up on the comma and the extra set of parenthesis On 11/15/2011 5:01 PM, Ivan Sergio Borgonovo wrote: On Tue, 15 Nov 2011 16:38:20 -0700 "J.V." wrote: How do I drop a function that was created like so: create or replace function proces

[GENERAL] deferring pk constraint

2011-11-15 Thread J.V.
I have a table with existing data for which I need to: 1) drop the single primary key column (int4) 2) recreate the column with the pk (not null) constraint deferred 3) repopulate the column from a sequence 4) enable the constraint When I issue this command to add the column: alter table add c

[GENERAL] monitoring sql queries

2011-11-17 Thread J.V.
the above to a log file Is there any tool internal to PostgreSQL that would allow me to do this? I cannot monitor it from the code that is actually connecting & sending the query. any help or pointers would be greatly appreciated. J.V. -- Sent via pgsql-general mailing list (pgsql-gen

Re: [GENERAL] monitoring sql queries

2011-11-17 Thread J.V.
09:29:11AM -0700, J.V. wrote: I am in need of a tool or method to see each/every SQL query that hits the PostgreSQL database. By query I mean the query in SQL syntax with all the parameters passed. What I want to do is: 1) see the query 2) Determine how long the query takes to execute

Re: [GENERAL] monitoring sql queries

2011-11-17 Thread J.V.
What is a GUC and how do I use it? On 11/17/2011 9:46 AM, Tomas Vondra wrote: On 17 Listopad 2011, 17:32, hubert depesz lubaczewski wrote: On Thu, Nov 17, 2011 at 09:29:11AM -0700, J.V. wrote: I am in need of a tool or method to see each/every SQL query that hits the PostgreSQL database. By

[GENERAL] MS SQL Server (2005, 2008) ==> PostgreSQL 9.x

2011-11-18 Thread J.V.
ber data should be no problem, but when not sure about exporting/importing binary data. If there is a tool out there, or I should just dump out as csv and import, let me know. thanks J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscript

[GENERAL] stored function data structures - difficulty

2011-11-21 Thread J.V.
it works. thanks J.V. -- 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] PostgreSQL uninstall fails

2011-11-22 Thread J.V.
leave the common things around of course, but uninstalling a single instance leaves a lot of droppings around that need to be manually cleaned up. J.V. On 11/10/2011 8:18 PM, Craig Ringer wrote: On 11/11/2011 06:18 AM, J.V. wrote: yes, this is on windows. Currently removing the data dir

Re: [GENERAL] stored function data structures - difficulty

2011-11-29 Thread J.V.
1) What is "a1" ? 2) Where did the queries below come from? 3) What information does each query below provide? On 11/21/2011 9:14 PM, Pavel Stehule wrote: Hello 2011/11/22 J.V.: I cannot find a way to programatically: 1. Given a table name, find all foreign key fields in

[GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread J.V.
to do this on three databases, I have figured out how to do this in Oracle (build a string and the EXECUTE IMMEDIATE , but have not figured out how to do this with PostgreSQL. any ideas? thanks J.V. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread J.V.
that contains the create sequence statement and execute that string, at least this is the way it is done in Oracle. I do not know how to use a variable in a create sequence statement in PostgreSQL. J.V. On 4/27/2012 9:51 AM, Merlin Moncure wrote: On Fri, Apr 27, 2012 at 10:37 AM, J.V

[GENERAL] how to execute a stored function that returns a boolean?

2012-04-27 Thread J.V.
I have created a stored function and wish to execute in pgadmin but keep getting an error. create or replace function myfunc() returns boolean as $$ declare begin ... end; $$ language plpgsql; compiles and works just find, however when I run (in pgadmin III) select myfunc(); I get errors tell

[GENERAL] How to update a newly added column with sub selects?

2012-04-28 Thread J.V.
I am starting with, so this might show 1 2 3 4 update table set new_column_id = (select id2 from join_table2 where new_column_id=2); but I do not want to write a loop and iterate through this stament passing 1,2,3,4 to the above statement, just a single statement. Is this possible? thanks

Re: [GENERAL] How to update a newly added column with sub selects?

2012-04-30 Thread J.V.
te inside a loop substituting each person_id from the array at each iteration, and updating each row one by one. Ideally would simply like one single update statement to do it all, but not sure if there is a facility for this, or how it could be done. thanks for your help. J.V. On 4/28/

[GENERAL] varchar for loops possible?

2012-05-18 Thread J.V.
I have a table with a varchar column. I want to select the distinct values from this column and loop through them (using as a variable) in a raise notice statement and also in an update statement. I have not been able to do this trying over 100 things in the last two hours. I could not find