[GENERAL] a few Questions about quoted variables in psql

2004-06-30 Thread Leo Leo
Hi!

How can I interpret a variable in psql, when the variable has to be quoted?

for example:

\set myVar myValue
\echo :myVar
The Result ist then "myValue" ==> ok

But: in my case the variable-values have to be in quotes:

\set db_username myUsername
\set db_password myPassword

CREATE USER :db_username WITH PASSWORD :db_password

==> This will not work, because you need quotes

CREATE USER :db_username WITH PASSWORD ':db_password'

==> This will create the user with Password :db_password and not myPassword
(so it takes the name of the varibale and not den value)

I played a bit with excaping, but even '\'':db_password'\'' will not work

What can I do, in order to achieve, that psql interprets a variable in
quotes?

Another Problem:

How can I concatenate a variable with a string without having a space in
between?

\set foo bar
\echo :foo test
==> bar test  (but there is a space in between)

\echo :foo||test
==> this does not work (I want bartest)
Is it somehow possible to do this?

Thanks for your help!

Leo

-- 
+++ Jetzt WLAN-Router für alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[GENERAL] Does pglogical support PG 9.4.5?

2016-01-26 Thread leo
Hi all, 

I am test pglogical on PG 9.4.5, but I am not successfully even if I
install the latest version "postgresql94-pglogical-1.0.1-2". 
Is there any one running pglogical on PG 9.4.5 successfully? 
I describe my operation step, please help me to trouble shooting? 

provider node: 10.10.10.11 
subscriber node: 10.10.10.103 
  
Config pg_hba.conf on provider node: 

hostall postgres0.0.0.0/0 trust 
hostreplication postgres10.10.10.103/0  trust   
  
Config pg_hba.conf on subscriber node: 
  
hostall postgres0.0.0.0/0 trust 
hostreplication postgres10.10.10.11/0  trust   

Config the postgres.conf according to README 


1. Create subscribe node: 
Provider: 10.10.10.11 
 SELECT pglogical.create_node(node_name := 'subscriber_test_3',dsn :=
'hostaddr= 10.10.10.103 port=5509 dbname=testdb user=postgres'); 
 create_node 
- 
  2393536845 

2. Create replication ser 
 select pglogical.create_replication_set('replicate_gis_data', true, true,
true, true); 
 create_replication_set 
 
 2904604760 

3. Add table into replication set 

select
pglogical.replication_set_add_table('replicate_gis_data','test_table',
true); 


===Executing on subscriber node 
Enable the network connection on: 
  enbale network connection and replication connection without password 


1. Create provider: 
SELECT pglogical.create_node(node_name := 'provider_test_2',dsn :=
'hostaddr= 10.10.10.11 port=5508 dbname=testdb user=postgres'); 
create_node 
- 
  3082486013 


2. Create subscription to provider noede, executing on subscribe node 

select pglogical.create_subscription('replicate_gis_data_from_11',
'hostaddr= 10.10.10.11 port=5508 dbname=testdb
user=postgres',E'{"replicate_gis_data"}'); 



Error Message on subscriber node 
=== 

< 2016-01-12 19:45:41.396 UTC >DEBUG:  shmem_exit(1): 2 before_shmem_exit
callbacks to make 
< 2016-01-12 19:45:41.396 UTC >DEBUG:  shmem_exit(1): 6 on_shmem_exit
callbacks to make 
< 2016-01-12 19:45:41.396 UTC >DEBUG:  proc_exit(1): 2 callbacks to make 
< 2016-01-12 19:45:41.396 UTC >DEBUG:  exit(1) 
< 2016-01-12 19:45:41.396 UTC >DEBUG:  shmem_exit(-1): 0 before_shmem_exit
callbacks to make 
< 2016-01-12 19:45:41.396 UTC >DEBUG:  shmem_exit(-1): 0 on_shmem_exit
callbacks to make 
< 2016-01-12 19:45:41.396 UTC >DEBUG:  proc_exit(-1): 0 callbacks to make 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  reaping dead processes 
< 2016-01-12 19:45:41.397 UTC >LOG:  worker process: pglogical apply
26429:2377587811 (PID 967) exited with exit code 1 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  StartTransaction 
< 2016-01-12 19:45:41.397 UTC >LOG:  unregistering background worker
"pglogical apply 26429:2377587811" 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  name: unnamed; blockState:  
DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.397 UTC >LOG:  registering background worker
"pglogical apply 26429:2377587811" 
< 2016-01-12 19:45:41.397 UTC >LOG:  starting background worker process
"pglogical apply 26429:2377587811" 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  CommitTransaction 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  name: unnamed; blockState:  
STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  find_in_dynamic_libpath: trying
"/usr/pgsql-9.4/lib/pglogical" 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  find_in_dynamic_libpath: trying
"/usr/pgsql-9.4/lib/pglogical.so" 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  InitPostgres 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  my backend ID is 8 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  StartTransaction 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  name: unnamed; blockState:  
DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  CommitTransaction 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  name: unnamed; blockState:  
STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.397 UTC >DEBUG:  StartTransaction 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  name: unnamed; blockState:  
DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  CommitTransaction 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  name: unnamed; blockState:  
STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  StartTransaction 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  name: unnamed; blockState:  
DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  CommitTransaction 
< 2016-01-12 19:45:41.398 UTC >DEBUG:  name: unnamed; blockState:  
STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
< 2016-01-12 19:45:41.398 UTC >ERROR:  subscriber replicate_gis_data_from

Re: [GENERAL] How to recovery failed master after failover

2014-03-04 Thread leo
I wonder how to quickly recovery failed master? If I directly startup the
failed master as slave ( assign proper parameter), is there any problem? For
example, I don't do any copy operation in script of
recovery_1st_stage_command and recovery_2st_stage_command.

According to this document:
https://wiki.postgresql.org/wiki/Synchronous_Transfer, can I only copy AWL
for recovering failed master?



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/How-to-recovery-failed-master-after-failover-tp5794524p5794547.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
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 recovery failed master after failover

2014-03-04 Thread leo
   I find a solution to short the recover time by configure parameter
Synchronous Transfer. Refer to :
https://wiki.postgresql.org/wiki/Synchronous_Transfer.
   But I don't which postgreSQL will enable this parameter, I install
9.3.3-1 on redhat, but I don't find this parameter in postgresql.conf.
   Is there anyone use this parameter?

Leo



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/How-to-recovery-failed-master-after-failover-tp5794524p5794720.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] There is bug in PCS 0.9.26: configure pacemaker resource agent for PG stream replication

2014-03-06 Thread leo
Hi all,

   I just complete my HA configuration on Redhat 6.4 enterprise:
Clusterware: Pacemaker 1.1.8 ( CMAN .0.12.1, corosync 1.4.1 )
Resource manager: PCS  0.9.26
PostgreSQL 9.3.3.1
  Detailed configuration follow:
http://clusterlabs.org/wiki/PgSQL_Replicated_Cluster#PostgreSQL_.28node1_only.29


  Complete the configuration, we find all PostgreSQL is slave status. We
finally find the root cause after google  searching. PCS don't apply all
resource configuration definition, it cut configuration parameter at end of
the first "op"
  For example:
   pcs -f pgsql_cfg resource create pgsql pgsql \
   pgctl="/usr/bin/pg_ctl" \
   psql="/usr/bin/psql" \
   pgdata="/var/lib/pgsql/data/" \
   rep_mode="sync" \
   node_list="node1 node2" \
   restore_command="cp /var/lib/pgsql/pg_archive/%f %p" \
   primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5
keepalives_count=5" \
   master_ip="192.168.2.3" \
   restart_on_promote='true' \
   op start   timeout="60s" interval="0s"  on-fail="restart" \
  ==Other op definition is cut 
   After we upgrade PCS version to the latest 0.9.90. All problem disappear
:)

  BWT, we find the app connection does not be interrupted when RA
automatically switch sync replication to async replication ( for example we
kill the slave node). 




--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/There-is-bug-in-PCS-0-9-26-configure-pacemaker-resource-agent-for-PG-stream-replication-tp5795081.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] pg_start_backup: file has vanished from pg_subtrans/

2015-08-07 Thread Leo Baltus
Hi,

While backing up some postgresql-8.4.2 instances using
pg_start_backup()/pg_stop_backup()

We noticed that sometimes rsync complains:

file has vanished: "./data/pg_subtrans/3A37"
rsync warning: some files vanished before they could be transferred (code 24) 
at main.c(1039) [sender=3.0.6

We already have excluded pgsql_tmp/ pg_xlog/ and pg_stat_tmp/ so I was
tempted to exclude pg_subtrans/ as well. However some googling seems to
suggest that this might invalidate the backup:

https://groups.google.com/forum/#!msg/pgbarman/zQxg6pOXkZ8/AmTmVtUA3dEJ

I am not sure what to believe, either
 - my backup was invalid and I have to take measures to prevent this
   (and file a bug report)
 - I can ignore this *and* can safely exclude pg_trans/ from my backups.
 - there is some other workaround...


-- 
Leo Baltus


-- 
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] pg_start_backup: file has vanished from pg_subtrans/

2015-08-10 Thread Leo Baltus
Op 08/08/2015 om 14:24:00 -0400, schreef David Steele:
> On 8/7/15 7:01 AM, Leo Baltus wrote:
> >While backing up some postgresql-8.4.2 instances using
> >pg_start_backup()/pg_stop_backup()
> >
> >We noticed that sometimes rsync complains:
> >
> >file has vanished: "./data/pg_subtrans/3A37"
> >rsync warning: some files vanished before they could be transferred (code 
> >24) at main.c(1039) [sender=3.0.6
> 
> It's perfectly normal for Postgres to remove files during a backup.  If a
> table is dropped then the files storing that table will be deleted. Files
> can also be removed from pg_subtrans once they are no longer needed.
> 
> >We already have excluded pgsql_tmp/ pg_xlog/ and pg_stat_tmp/ so I was
> >tempted to exclude pg_subtrans/ as well. However some googling seems to
> >suggest that this might invalidate the backup:
> 
> I would recommend only excluding pg_xlog as recommended in the Postgres
> docs.
> 

Check.

> >https://groups.google.com/forum/#!msg/pgbarman/zQxg6pOXkZ8/AmTmVtUA3dEJ
> >
> >I am not sure what to believe, either
> >  - my backup was invalid and I have to take measures to prevent this
> >(and file a bug report)
> 
> Your backup should be good so long as you've captured all the WAL.
> 
> >  - I can ignore this *and* can safely exclude pg_trans/ from my backups.
> >  - there is some other workaround...
> 
> Do *not* exclude pg_subtrans.

Ok, for now I will ignore rsync's exit code 24.

> 
> You may also want to look at backup software such as pgBackRest.  It
> understands that files can be removed during backup and does not emit
> warnings when it happens (though info messages are still logged depending on
> your log level).

Thanks!

-- 
Leo Baltus


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] psql --quiet

2015-10-27 Thread Leo Baltus
postgresql-9.4.5

When running pg_stop_backup() psql outputs on stderr:

NOTICE:  pg_stop_backup complete, all required WAL segments have been archived

--quiet does not seem to suppress it, what does?

I really hate to redirect stderr to /dev/null.

-- 
Leo Baltus, internetbeheerder
NPO ICT Internet Services
Bart de Graaffweg 2, 1217 ZL Hilversum
serviced...@omroep.nl, 035-6773555


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] psql --quiet

2015-10-27 Thread Leo Baltus
postgresql-9.4.5

When running pg_stop_backup() psql outputs on stderr:

NOTICE:  pg_stop_backup complete, all required WAL segments have been archived

--quiet does not seem to suppress it, what does?

I really hate to redirect stderr to /dev/null.

-- 
Leo Baltus, internetbeheerder
NPO ICT Internet Services
Bart de Graaffweg 2, 1217 ZL Hilversum
serviced...@omroep.nl, 035-6773555


-- 
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] psql --quiet

2015-10-27 Thread Leo Baltus
Op 27/10/2015 om 15:32:46 +0100, schreef David Steele:
> On 10/27/15 3:16 PM, Leo Baltus wrote:
> >postgresql-9.4.5
> >
> >When running pg_stop_backup() psql outputs on stderr:
> >
> >NOTICE:  pg_stop_backup complete, all required WAL segments have been 
> >archived
> >
> >--quiet does not seem to suppress it, what does?
> 
> This should work:
> 
> set client_min_messages='warning';
> 
> This must be done in the same session as the pg_start_backup().
> 

Sweet.

Thanks David.

-- 
Leo Baltus, internetbeheerder
NPO ICT Internet Services
Bart de Graaffweg 2, 1217 ZL Hilversum
serviced...@omroep.nl, 035-6773555


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] postgresql ask for someparameters

2012-07-21 Thread leo xu
   hello everyone:
  i found database crashed,i checked log,it indicated error:
   CONTEXT:  xlog redo insert: rel 48777166/22362/48778276; tid 2/2 

 i wanted to know:what's meaning of real? and what's  meaning of
48777166/22362/48778276 ?what's meaning of tid 2/2  ?

please tell me it's meaning or where to find it ?thanks.
 



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/postgresql-ask-for-someparameters-tp5717522.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
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 calculate or know seq_scan scan how many blocks every time

2012-07-25 Thread leo xu
hello:
   i know oracle scatter read blocks,can set db_file_multiblock_read_count
every time,
   i see postgres,it exists scatter read blocks,it is seq_scan,how to know
scan many bloks every time?



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/how-to-calculate-or-know-seq-scan-scan-how-many-blocks-every-time-tp5717892.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Re: how to calculate or know seq_scan scan how many blocks every time

2012-07-26 Thread leo xu
hello  everyone
who can explain it ?thanks!



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/how-to-calculate-or-know-seq-scan-scan-how-many-blocks-every-time-tp5717892p5718082.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] what happens when concurrent index create

2012-04-03 Thread leo xu
i read documents,i find it that concurrent index create don't lock write.but
need scan table twice.it explain is following as:
   It scans the table once to initially build the index, then makes a second
pass to look for things added after the first pass.

please explain 1. what happens  when concurrent index create .tks.
   2.how to trace a backend what do somethings internal.for
example oracle 10046 trace.

--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/what-happens-when-concurrent-index-create-tp5615720p5615720.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] postgresql standby using pg_archivecleanup don't work

2012-04-27 Thread leo xu
i have one parimary ,two standby. one standby using stream replication
connect to primary.another standby using basebackup,then recovery database
--cp archivelog from primary using crontab.i want to delete old archivelog
from standby.but configure pg_archivecleanup don't work,meantime no error in
postgresql log.postgresql version is 9.1.2.
   the following is my recovery.conf :
   This is my recovery.conf:

standby_mode = 'on'
restore_command = 'cp /attend_pg_backup/u02/pg9.1/archivelog/%f %p'
archive_cleanup_command ='pg_archivecleanup
/attend_pg_backup/u02/pg9.1/archivelog %r'



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/postgresql-standby-using-pg-archivecleanup-don-t-work-tp5669340p5669340.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] postgresql log indicate too many execute S_2:COMMIT

2012-04-28 Thread leo xu
Hello:
I test postgresql database performance recently,i set
log_min_duration_statement=1000;
i monitor pg_log file,i find too many execue S_2:commit
10.0.44.21:30170:2012-04-28 11:38:46.340 CSTLOG:  duration: 1050.679 ms 
execute S_2: COMMIT

10.0.44.21:30208:2012-04-28 11:38:46.340 CSTLOG:  duration: 1050.576 ms 
execute S_2: COMMIT

10.0.44.21:30318:2012-04-28 11:38:46.340 CSTLOG:  duration: 1028.171 ms 
execute S_2: COMMIT



please explain what meaning,how to cause it ,how to deal with it?thank you !

--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/postgresql-log-indicate-too-many-execute-S-2-COMMIT-tp5672225p5672225.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
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 standby using pg_archivecleanup don't work

2012-04-28 Thread leo xu
hello:
i try it,but it nothing in pg_log.it still don't work!

--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/postgresql-standby-using-pg-archivecleanup-don-t-work-tp5669340p5672191.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
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 log indicate too many execute S_2:COMMIT

2012-05-02 Thread leo xu
 my postgres version is 9.1.2.my machine is dell R710.3000 sessions 
connect to database concurrently,then doing some insert,delete,update.
 your meaning my database bottleneck is disk io slowly.i use local
disk.i know transaction log need to wirte to disk.
 thanks.i will monitor it.

--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/postgresql-log-indicate-too-many-execute-S-2-COMMIT-tp5672225p5682141.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
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 allow non-local to postgreSQL

2006-05-09 Thread leo camalig
Good Day        I Just want to ask on how to allow a non-local in PostgreSQL without adding it in   pg-hba.conf     I just want to view a desktop application on Web, yes it works, but you need to allow those I.P. addresses that will gonna connect to postgreSQL. What I want is everyone in the net can access the said desktop application. Can you help me on how to configure it.     thank you very much
		Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

[GENERAL] RH7.3 / PGSQL7.4.1 binary distribution

2004-03-09 Thread Leo Sutic
Hi!

I tried to find the binary distribution of Postgresql 7.4.1 for RedHat
7.3. The FTP directory was empty so I Googled for it and found some RPMs
at
http://developer.postgresql.org/ftpsite/binary/v7.4.1/redhat/redhat-7.3/
. However, when I tried to dowload them I received a "403 Forbidden"
response. Should these RPMs not be readable? And is this why the FTP
directory is empty (replication fails due to file permissions being set
too restrictive)?

/LS


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


[GENERAL] create a text file from postgres (like Oracle UTL_FILE package)

2004-11-04 Thread Leo Martin Orfei
Hi,

Anybody know/have functions or package to create text
file from postgres function?

I want to execute a function to take some fields from
a table and save it in a text file (or xml format).
I need function like:
createfile(filename);
appendtofile(filename,text);
etc.

thanks




__ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [GENERAL] create a text file from postgres (like Oracle UTL_FILE package)

2004-11-06 Thread Leo Martin Orfei
ok. I gonna explain a little more my situation.

I have a postgres server (Linux) and clients
(Win2k+delphi application).
I need create  a text file with some columns from a
table in the server machine, but this file must be
created only when the user wants.  (click button on my
delphi program on the client side create a text file
on the server file system). 
I can't share o mount a resource or connect by socket.
I think execute a postgres function from delphi and
leave to postgres a work to create the file.

so, my problem is how to create a text file from a
postgres function. may be I can use a java program
(like Oracle Java Stored Procedures). 
How I execute a external java program from postgres
function?
exist some OS system call in postgres?

something like
Create or Replace Function run () returns  int4 as
begin
execute_OS_system_call('java -jar someapp.jar');
return (1);
end;

thanks

--- "Thomas F.O'Connell" <[EMAIL PROTECTED]> wrote:

> At this point, I'm not sure I'm understanding your
> question. I'll try 
> restating my solution again:
> 
> I would have, for example, a Perl script that used
> the DBI module to 
> extract information from a given database and then
> let Perl handle any 
> relevant text/data manipulation and file
> creation/manipulation.
> 
> DBI should allow the execution of arbitrary SQL
> against any supported 
> database, and postgres is supported.
> 
> Also, I'd recommend continuing to post and not
> merely emailing me 
> directly to keep more eyes on your problem.
> 
> -tfo
> 
> --
> Thomas F. O'Connell
> Co-Founder, Information Architect
> Sitening, LLC
> http://www.sitening.com/
> 110 30th Avenue North, Suite 6
> Nashville, TN 37203-6320
> 615-260-0005
> 
> On Nov 5, 2004, at 12:20 PM, Leo Martin Orfei wrote:
> 
> > If I let the script connect to DB and create files
> (I
> > belive in this solution), how   I execute the
> script
> > from a client side? may be a function? some OS
> system
> > call?
> >
> > thanks.
> >
> > --- "Thomas F. O'Connell" <[EMAIL PROTECTED]>
> wrote:
> >
> >> You're thinking about it in reverse. Let the
> script
> >> make calls via a
> >> database interface. There are database interfaces
> to
> >> postgres in a
> >> variety of modern programming languages.
> >>
> >> -tfo
> >>
> >> --
> >> Thomas F. O'Connell
> >> Co-Founder, Information Architect
> >> Sitening, LLC
> >> http://www.sitening.com/
> >> 110 30th Avenue North, Suite 6
> >> Nashville, TN 37203-6320
> >> 615-260-0005
> >>
> >> On Nov 5, 2004, at 7:24 AM, Leo Martin Orfei
> wrote:
> >>
> >>> ok, this appears to be a good solution...
> >>>
> >>> so, how I execute a perl (or C, or bash ) script
> >> from
> >>> a postgresql function?
> >>>
> >>> if I use C (I think that write C code and use it
> >> in
> >>> the  database is possible), I have to connect to
> >> the
> >>> database from my C code or it's embebed and I
> can
> >> use
> >>> tables directly?
> >>>
> >>> thanks.
> 
> 
> ---(end of
> broadcast)---
> TIP 8: explain analyze is your friend
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[GENERAL] Update from select??

2003-07-03 Thread jose antonio leo
Hi all,

I need do a update from t1 set col='P' where int_art = (SELECT int_art from
t2 ).
I know that thios sentence is not correct but I'd like do the update for
everethigs rows that return the select.

Is it posible?

Tk very much

Jose Antonio




-Mensaje original-
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] nombre de Thomas
Bamesberger
Enviado el: jueves, 03 de julio de 2003 14:51
Para: Tom Lane
CC: [EMAIL PROTECTED]
Asunto: Re: [GENERAL] ERROR: fixrdesc: no pg_class entry for pg_class


Am Mit, 2003-07-02 um 16.55 schrieb Tom Lane:
> Thomas Bamesberger <[EMAIL PROTECTED]> writes:
> > My PostgreSQL Database has been up and running exactly for one year, but
> > last week after rebooting the error message "fixrdesc: no pg_class entry
> > for pg_class" appeared on the screen. So is there any way to solve this
> > problem or to recover the data at least?
>
> Ouch.  You have a problem :-(
>
> Are you seeing this failure when you connect to any database in the
> cluster, or just one?

There is only one DB...

> If the former, I'd guess that you've been
> ignoring messages about needing a cluster-wide VACUUM for a little too
> long, and you're now hosed due to transaction wraparound.  If the
> latter, it's probably localized data corruption in that database's
> system catalog.  Which is not necessarily any better news, but there
> are a couple of desperation measures you can try:
>
> 1. Remove the "pg_internal.init" file in the broken database, then see
> if you can start a backend.
>
> 2. Try to start a standalone backend and reindex the system catalogs.
> (See the REINDEX man page for details on this rather arcane procedure.)

Thx for your hints, but neither of them did anything else than:
"fixrdesc: no pg_class entry for pg_class"

:(

Any other idea? I really would appreciate it...

Thx in advance

--
Thomas Bamesberger <[EMAIL PROTECTED]>


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] update innside transactions?

2003-07-28 Thread jose antonio leo
Hi!

I have a doubt, I have somethigs same this... 

init transaction
  
  update from tabla1 set estado=1 where art=0;

  update from tabla1 set estado=estado+1 where estado=1

final trasaction

The second update take the first updates if we are in the same transaction?

Tk 

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match