Re: [SQL] Bizarreness at A2 Hosting

2011-03-17 Thread John DeSoi
tly the problem is - I am waiting for a > supervisor to call me back and I'd like to lead him to the answer so he can > fix the problem. I think you are right -- they likely have some one's stuff in the template database. On your account that does not have the problem -- is i

Re: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread John DeSoi
ction test () returns void as $$ declare rec record; begin for rec in select * from whatever loop insert into some_table values (rec.*); end loop; end; $$ language plpgsql; John DeSoi, Ph.D. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.or

Re: [SQL] pl/pgsql or control structures outside of a function?

2009-04-03 Thread John DeSoi
CASE might work for you. http://www.postgresql.org/docs/8.3/interactive/functions-conditional.html John DeSoi, Ph.D. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] simple text parsing function

2008-11-22 Thread John DeSoi
t rtrim('BPZ8 CURNCY ') like '%CURNCY'; --> true select rtrim('BPZ8 CURNCY ')::char(25) like '%CURNCY'; --> false Interestingly, it works if you make your comparison using ~ '.*CURNCY' John DeSoi, Ph.D. -- Sent via pgsql-sql mailin

Re: [SQL] doubt

2007-05-19 Thread John DeSoi
7;, 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 1,2; ** List of relations Schema | Name | Type | Owner +--+--+--- public | barcode

Re: [SQL] PL/PGSQL Record type question

2007-05-11 Thread John DeSoi
parameters so you don't need the CREATE TYPE statement. On May 11, 2007, at 10:42 AM, Gábriel Ákos wrote: You might be looking for PostgreSQL RECORD data type. Thanks. Give me an example please. I saw the documentation already. John DeSoi, Ph.D. http://pgedit.com/ Power Tool

Re: [SQL] plpgsql array looping

2007-04-25 Thread John DeSoi
idxptr in 1 .. array_upper(p_idxarray, 1) loop exit when p_idxarray[idxptr] >= p_idx; idxptr := idxptr +1; raise notice 'idx ptr: %', idxptr; end loop; John DeSoi, Ph.D. http://pgedit.com/ Power Tools f

Re: [SQL] plpgsql function question

2007-04-04 Thread John DeSoi
, 2007, at 1:01 AM, A. Kretschmer wrote: Because your function expects one parameter of your new type, you have to CAST your data into this type: test=# select * from my_a((1, 'foo', current_date)::a); my_a -- 1 (1 row) John DeSoi, Ph.D. http://pgedit.com/ Power Tools for

Re: [SQL] plpgsql function question

2007-04-03 Thread John DeSoi
ple. John On Apr 3, 2007, at 2:33 PM, Karthikeyan Sundaram wrote: What I want is something like this create or replace functinon a_func (in a%rowtype) returns int as $$ do the validation $$ language 'plpgsql'; execute a_func(1, 'good','04/02/2007'); Jo

Re: [SQL] How to store a password encripted in a user defined table

2007-03-01 Thread John DeSoi
e: Thanks Andrej. But how can I use such algoritms in postgresql? arey they defined in a function that I can call? Or, do I have to code one of those algorithm to use it in my application? John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-08 Thread John DeSoi
, but get a new primary key for the copy? I'd then go in an edit the 1 or 2 additional columns that differ. The duplicate would be in the same table as the original. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broa

Re: [SQL] Some help with functions-syntax

2007-01-18 Thread John DeSoi
x27;select ...' _sql := _sql + ' where ...' But using the form without execute is much better. PostgreSQL will only have to plan the query the first time it is called. Using EXECUTE is much less efficient. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL -

Re: [SQL] Some help with functions-syntax

2007-01-17 Thread John DeSoi
, Jan Meyland Andersen wrote: I have some problem with writing a function. I have made this function which I can't get it to work. This is probaly a triviel question but i'm new to plsql, so this is a showstopper for me. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for

Re: [SQL] ERROR: SELECT query has no destination for result data

2006-08-31 Thread John DeSoi
ot;SELECT num_em_pdv.id is null" PL/pgSQL function "inserirpontos" line 30 at if Thank you John. I think I should stay with the record type. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] ERROR: SELECT query has no destination for result data

2006-08-31 Thread John DeSoi
base.emissor_ponto_venda where id = PontoVenda_Emissor; See http://www.postgresql.org/docs/8.1/interactive/plpgsql- statements.html#PLPGSQL-SELECT-INTO John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast

Re: [SQL] [PHP] PL/pgSQL and PHP 5

2006-08-09 Thread John DeSoi
ike a normal PHP method call: $connection->insert_staff_b($staff['insert_firstname']); John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] [PHP] PL/pgSQL and PHP 5

2006-08-09 Thread John DeSoi
have different capitalization. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread John DeSoi
On Jul 31, 2006, at 10:59 AM, Aaron Bono wrote: On 7/31/06, John DeSoi <[EMAIL PROTECTED]> wrote: Is it really necessary to build a SQL string and use execute? It seems you could just issue the INSERT statement. I don't think so but there was some discussion a week or two ago a

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread John DeSoi
''my_value, '' || ''create_dt '' || '') VALUES ( '' || '''''''' || NEW.my_table_id || '''''', '' || ''''

Re: [SQL] sessions and prepared statements

2006-06-16 Thread John DeSoi
ably more PHP expertise there. Best, John John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] global variables in plpgsql?

2006-04-10 Thread John DeSoi
lobal variables. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread John DeSoi
o fix it. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread John DeSoi
e: select foo, (select x from generate_x(bar)) from test; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Copying a row within table

2006-03-14 Thread John DeSoi
:= nextval(pg_get_serial_sequence('test', 'id')); insert into test values (tt.*); return tt.id; end; $$ language plpgsql; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP

Re: [SQL] Executing plpgsql scripts using psql, is that possible?

2006-01-16 Thread John DeSoi
he final tables. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Executing plpgsql scripts using psql, is that possible?

2006-01-16 Thread John DeSoi
;another string'); AddObjectProperty(V_MyObjectID, 'a string'); AddObjectProperty(V_MyObjectID, 'another string'); END; $$ language plpgsql; SELECT my_function(1); and then psql -f script.sql my_db John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL

[SQL] info is a reserved word?

2006-01-12 Thread John DeSoi
my_info as $$ declare info my_info; begin info.a := 'hi'; info.b := 'there'; return info; end; $$ language plpgsql; Evaluating this definition gives: psql:16: ERROR: syntax error at or near "info" at character 71 psql:16: LINE 4: in

Re: [SQL] catching errors in function

2005-10-06 Thread John DeSoi
://www.postgresql.org/docs/8.0/interactive/plpgsql-control- structures.html#PLPGSQL-ERROR-TRAPPING John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an

Re: [SQL] Please help, can't figure out what's wrong with this function...

2005-09-12 Thread John DeSoi
uot; AS ( DECLARE objReturn ty_stadtlandflussentry; Maybe it needs to be: declare objReturn "public"."ty_stadtlandflussentry"%rowtype; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- T

Re: [SQL] Number of rows in a cursor ?

2005-08-24 Thread John DeSoi
/interactive/sql-move.html John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] incorrect syntax for 'plpgsql' function to test boolean values

2005-08-06 Thread John DeSoi
e))" PL/pgSQL function "trigger_insert_update_registration_and_attendance" line 13 at if What is wrong with my syntax above? Too much C programming :). You just want a single equal sign. select true = true; ?column? ------ t (1 row) John DeSoi, Ph.D. http://pgedit.com

Re: [SQL] echo/printf function in plpgsql

2005-07-19 Thread John DeSoi
27;, t; If I recall correctly, the values to be inserted into the format string can only be variables, not expressions. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 9: In versions below 8.0, the plan

Re: [SQL] Error on dynamic code.

2005-07-15 Thread John DeSoi
to use a cursor with OPEN-FOR- EXECUTE, as described in Section 35.8.2. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] How do I quit in the middle of a SQL script?

2005-05-20 Thread John DeSoi
t the following large chunk is supposed to do) Can I do that? Put this at the start of the file to make psql stop if there is an error: \set ON_ERROR_STOP 1 And is it a good idea to add arbitrary code to the database dump sql script? No problem if you know what you are doing and/or have good backups :)

Re: [SQL] php wrapper

2005-04-24 Thread John DeSoi
f by wrapper you mean an abstraction to support other databases, what other systems do you need to support? PEAR seems to have a nice databases abstraction layer (DB.php). Drupal uses this to support PostgreSQL and MySQL. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---

Re: [SQL] getting count for a specific querry

2005-04-09 Thread John DeSoi
thout changing the rows you are viewing. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so

Re: [SQL] getting count for a specific querry

2005-04-09 Thread John DeSoi
table and column information from a cursor. If I fetch from a cursor, the table OID and column number values are 0 in the row description. If I execute the same query directly without a cursor, the row description has the correct values for table OID and column number. J

Re: [SQL] Question on triggers and plpgsql

2005-04-08 Thread John DeSoi
ively expensive (since the triggering event state has to be saved and then recalled) so I could see making that tradeoff if performance is critical. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: Have

Re: [SQL] Question on triggers and plpgsql

2005-04-08 Thread John DeSoi
. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Question on triggers and plpgsql

2005-04-08 Thread John DeSoi
ng to happen? I did not notice any problems. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] pl/pgsql problem with return types

2005-03-11 Thread John DeSoi
On Mar 11, 2005, at 5:54 AM, Juris Zeltins wrote: FOR P IN select pageid from pages This way you are only getting the pageid column. I think what you want is FOR P in select * from pages so that P contains the complete pages record. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-07 Thread John DeSoi
if you startup psql with the -E option it will show you all the SQL it is using to run the \d command. It should be fairly easy to get the strings you need from the results of running a similar query. The psql source is a good place to look also. John DeSoi, Ph.D. http://pgedit.com/ Power Tools

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-07 Thread John DeSoi
you can use to determine if there is a mismatch. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL] RE: [SQL] trrouble inserting stuff like é

2005-02-18 Thread John DeSoi
On Feb 18, 2005, at 11:15 AM, Joel Fradkin wrote: How do I tell the connection to use Unicode? Try SET client_encoding TO 'UNICODE'; http://www.postgresql.org/docs/8.0/interactive/sql-set.html But it should default to the database encoding, so I'm not sure if that is the probl

Re: [SQL] How to iterate through arrays?

2005-02-09 Thread John DeSoi
y use simple variables in the format string. Try it like: myTextVar := update_query_params[1]; NOTICE '% ...',myTextVar; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Updating selected record

2005-02-08 Thread John DeSoi
; This locks the row for the remainder of the transaction. See http://www.postgresql.org/docs/8.0/interactive/sql-select.html#SQL-FOR- UPDATE John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: Have you

Re: [SQL] error in function!!

2005-01-31 Thread John DeSoi
ct type. So the message above says the first parameter passed was an integer, but your function expects the first parameter to be text. Note that you can remove all of the ALIAS declarations and use parameter name directly. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] plpgsql select into with multiple target variables

2005-01-28 Thread John DeSoi
ke SELECT into varx, vary, varz, colx, coly, colz, FROM I've tried parens and various other things but no luck. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 6: Have you searched our list arc

Re: [SQL] Moving from Transact SQL to PL/pgsql

2005-01-25 Thread John DeSoi
racle, but there is a porting section in the documentation: http://www.postgresql.org/docs/8.0/interactive/plpgsql-porting.html John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 9: the planner will ignore

Re: [SQL] editors with colum positioning for debugging?

2005-01-22 Thread John DeSoi
command to jump to a specific offset in the file. I hope to have something better in the near future to automatically move the cursor for you when an error is detected. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)-

Re: [SQL] Looking for examples of S/P

2005-01-19 Thread John DeSoi
nsive example for importing and analyzing web server logs using only SQL and PL/pgSQL. Look in the pgEdit/Examples/web folder after installation. http://pgedit.com/download John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broa

Re: [SQL] Problems with Quotes

2005-01-12 Thread John DeSoi
l.org/docs/7.4/static/plpgsql-development-tips.html John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Problems with Quotes

2005-01-12 Thread John DeSoi
ail, do I need to use something like an ASCII character code in order to get rid of a quote? If so which one, and if not, is there a better solution? Try '"' as in select replace('this "is" it', '"', ''); repl

Re: [SQL] Table History

2004-12-17 Thread John DeSoi
ant some extra trigger examples other than what is in the documentation, there is a test file in the distribution with quite a few: src/test/regress/sql/plpgsql.sql Best, John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)

Re: [SQL] Hide schemas and tables

2004-12-13 Thread John DeSoi
foreign schemas and relations from beeing seen. Yes, you are correct. I'm not aware of any way to hide this information. Best, John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL ---(end of broadcast)--- TIP 5: Have you checke

Re: [SQL] Postgres Doubt

2004-10-03 Thread John DeSoi
sql to your database. see http://www.postgresql.org/docs/current/interactive/app-createlang.html http://www.postgresql.org/docs/current/interactive/sql- createlanguage.html You generally want to do this for template1 so it will be available in any new database you create. Best, John DeSoi, Ph.D.

Re: [SQL] colored PL with emacs

2004-09-01 Thread John DeSoi
. The estimated price for this product is $65. Send me an email if you are interested in beta testing the Mac OS X version. Best, John DeSoi, Ph.D. ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] sleep function

2004-08-23 Thread John DeSoi
e other pl languages), but I assume there will be additional installation and configuration issues to use them. But thanks for the example, it will be helpful if I need something more processor friendly. Best, John DeSoi, Ph.D. ---(end of broadcast)---

Re: [SQL] sleep function

2004-08-11 Thread John DeSoi
On Aug 10, 2004, at 10:57 AM, Bruce Momjian wrote: I can't think of one, no. I think you will have to use one of the server-side languages and call a sleep in there. This is no good in the real world since it pounds the CPU, but it worked well enough for my testing purposes. Best, John

[SQL] sleep function

2004-08-10 Thread John DeSoi
Is there a sleep function of some kind? I wanted to simulate a query taking a long time to execute for testing purposes. Thanks, John DeSoi, Ph.D. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http

Re: [SQL] Object-relational features

2004-03-15 Thread John DeSoi
t type. So your selects will return the column type as your custom type and you can process the content accordingly. From reading the docs (and asking on the list) I did not think this was possible either without writing external code in C. But a post about something else finally provided the clue

Re: [SQL] A simple way to Create type ...?

2003-09-16 Thread John DeSoi
ption information returned by SELECT. All columns just look like varchar(50). It would be nice if there was something as easy as CREATE DOMAIN but worked more like CREATE TYPE. Best, John DeSoi, Ph.D. ---(end of broadcast)--- TIP 9: the planner