Probably a stupid question

Lists: pgsql-novice
From: phil campaigne <pcampaigne(at)charter(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Best Practice??
Date: 2003-06-26 19:40:21
Message-ID: 3EFB4C25.4020802@charter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi All,
I'm realtively new to linux and postgresql. My application gets the
following error when it tries to store a record:
java.lang.NullPointerException
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:566)
at null.null(Unknown Source)
at null.null(Unknown Source)
at null.null(Unknown Source)
at null.null(Unknown Source)
at null.null(Unknown Source)
at java.lang.Thread.run(Thread.java:566)

********************************
When I execute the same instruction at the command line it stores it
successfully. I'm not sure its related but I wonder if there is
something I am doing wrong with setting file permissions.
1. Any idea what's causing this error?
2. What is the Best Practice for setting file ownership and log on for
development?
I have been doing most of my work logging on as root but I know that is
not best. When I changed to another user name I'm afraid it has caused
the application to not see the database files or other developed files.

Your thoughts would be appreciated,
Phil Campaigne


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: phil campaigne <pcampaigne(at)charter(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Best Practice??
Date: 2003-06-27 02:43:08
Message-ID: 23533.1056681788@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

phil campaigne <pcampaigne(at)charter(dot)net> writes:
> I'm realtively new to linux and postgresql. My application gets the
> following error when it tries to store a record:
> java.lang.NullPointerException

If you get no answer here, try pgsql-jdbc. I think most of the folk
who read this list aren't big Java users ...

regards, tom lane


From: "Ramil G(dot) Sagum" <ramil(at)astra(dot)ph>
To: pgsql-novice(at)postgresql(dot)org
Subject: last id
Date: 2003-06-27 03:41:35
Message-ID: 1056685295.7712.19.camel@arwen.hq.astra.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

is there a way to

1. insert a row to table A
2. get the value of the serial field from the now in no.1
3. insert a row to table B (one of the fields uses the value from no.2)

in -one transaction-?

i'm currently doing it using functions, but is there another way?
(kind of like the mysql_insert_id function in mysql)

ramil


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: ramil(at)astra(dot)ph, pgsql-novice(at)postgresql(dot)org
Subject: Re: last id
Date: 2003-06-27 04:28:56
Message-ID: 200306262128.56135.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Ramil,

> 1. insert a row to table A
> 2. get the value of the serial field from the now in no.1
> 3. insert a row to table B (one of the fields uses the value from no.2)
>
> in -one transaction-?

BEGIN TRANSACTION

INSERT INTO table_a ( 2, 3, 4 )
VALUES ( x, y, z );
INSERT INTO table_b ( a_FK, 3, 4 )
VALUES ( CURRVAL('table_a_seq'), m, q );

COMMIT TRANSACTION

Easy, neh? Now go to the online docs and do some reading about Sequences.

--
Josh Berkus
Aglio Database Solutions
San Francisco


From: "Giorgio Ponza" <g(dot)ponza(at)opla(dot)it>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Probably a stupid question
Date: 2003-06-27 07:37:19
Message-ID: 043501c33c7e$f097c550$ae4990d5@pcguru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi all, and tx for all the help you give to the community
I have a question, really stupid, but i'd like to understand the postgres
behavior.
I installed dbmirror, and there is a file script creating a table, something
like this:
CREATE TABLE "MirrorHosts" ..... etc etc

Ok, no prob with the syntax (3 years i use postgreSQL), but when i use psql
i have this problems:
1) the command \d MirrorHosts doesn't work (table MirrorHost not found),
i have to use \d "MirrorHosts"
2) when i do SELECT * FROM MirrorHosts; (the same prob)
i have to use "MirrorHosts"

I'd like to know if there is a way to bypass this problem.
Tx in advance and ..... PostgreSQL is really GREAT!

Giorgio Ponza


From: "Chad Thompson" <chad(at)weblinkservices(dot)com>
To: "Giorgio Ponza" <g(dot)ponza(at)opla(dot)it>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Probably a stupid question
Date: 2003-06-27 20:16:17
Message-ID: 011701c33ce8$f801e9a0$32021aac@chad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I believe your problem is simply with the case of the table name. You might
want to try \d mirrorhosts. If the table was created "MirrorHosts" (which
it looks like it was) postgresql will store that name and you will be
required to reference it like that.

I believe there is something in the docs about case sensitivity, but I cant
seem to find it now.

HTH
Chad
----- Original Message -----
From: "Giorgio Ponza" <g(dot)ponza(at)opla(dot)it>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: Friday, June 27, 2003 1:37 AM
Subject: [NOVICE] Probably a stupid question

> Hi all, and tx for all the help you give to the community
> I have a question, really stupid, but i'd like to understand the postgres
> behavior.
> I installed dbmirror, and there is a file script creating a table,
something
> like this:
> CREATE TABLE "MirrorHosts" ..... etc etc
>
> Ok, no prob with the syntax (3 years i use postgreSQL), but when i use
psql
> i have this problems:
> 1) the command \d MirrorHosts doesn't work (table MirrorHost not found),
> i have to use \d "MirrorHosts"
> 2) when i do SELECT * FROM MirrorHosts; (the same prob)
> i have to use "MirrorHosts"
>
> I'd like to know if there is a way to bypass this problem.
> Tx in advance and ..... PostgreSQL is really GREAT!
>
> Giorgio Ponza
>
>
>
> ---------------------------(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
>