[gold-users] Error in gchproject after adding an object attribute

Scott Jackson scottmo at adaptivecomputing.com
Thu Feb 4 10:40:16 MST 2010


Hazlewood, Victor Gene wrote:
>
> And the ShowUsage for Project Modify is the following: Hmmm, looks 
> like DisplayProject is missing from this list. That’s a clue…
>
> $ goldsh Project Modify ShowUsage:=True
>
> <Request action="Modify">
>
> <Object>Project</Object>
>
> [<Set name="Active" [op="Assign (Assign)"]>True|False (True)</Set>]
>
> [<Set name="Organization" [op="Assign (Assign)"]>{Organization}</Set>]
>
> [<Set name="GrantNumber" [op="Assign (Assign)"]>{}</Set>]
>
> [<Set name="AmieTransaction" [op="Assign|Inc|Dec (Assign)"]>{Integer 
> Number} (0)</Set>]
>
> [<Set name="AmieActive" [op="Assign (Assign)"]>True|False (False)</Set>]
>
> [<Set name="NccsProjectId" [op="Assign (Assign)"]>{}</Set>]
>
> [<Set name="SentToNccs" [op="Assign (Assign)"]>True|False (False)</Set>]
>
> [<Set name="Pi" [op="Assign (Assign)"]>{}</Set>]
>
> [<Set name="PrjType" [op="Assign (Assign)"]>{}</Set>]
>
> [<Set name="Fos" [op="Assign|Inc|Dec (Assign)"]>{Integer Number}</Set>]
>
> [<Set name="Description" [op="Assign (Assign)"]>{Description}</Set>]
>
> [<Where name="Name" [op="eq|ne|gt|ge|lt|le|match (eq)"] [conj="And|Or 
> (And)"] [group="<Integer Number>"]>{Project Name}</Where>]
>
> [<Where name="Active" [op="eq|ne (eq)"] [conj="And|Or (And)"] 
> [group="<Integer Number>"]>True|False</Where>]
>
> [<Where name="Organization" [op="eq|ne|gt|ge|lt|le|match (eq)"] 
> [conj="And|Or (And)"] [group="<Integer Number>"]>{Organization}</Where>]
>
> [<Where name="GrantNumber" [op="eq|ne|gt|ge|lt|le|match (eq)"] 
> [conj="And|Or (And)"] [group="<Integer Number>"]>{}</Where>]
>
> [<Where name="AmieTransaction" [op="eq|ne|gt|ge|lt|le (eq)"] 
> [conj="And|Or (And)"] [group="<Integer Number>"]>{Integer Number}</Where>]
>
> [<Where name="AmieActive" [op="eq|ne (eq)"] [conj="And|Or (And)"] 
> [group="<Integer Number>"]>True|False</Where>]
>
> [<Where name="NccsProjectId" [op="eq|ne|gt|ge|lt|le|match (eq)"] 
> [conj="And|Or (And)"] [group="<Integer Number>"]>{}</Where>]
>
> [<Where name="SentToNccs" [op="eq|ne (eq)"] [conj="And|Or (And)"] 
> [group="<Integer Number>"]>True|False</Where>]
>
> [<Where name="Pi" [op="eq|ne|gt|ge|lt|le|match (eq)"] [conj="And|Or 
> (And)"] [group="<Integer Number>"]>{}</Where>]
>
> [<Where name="PrjType" [op="eq|ne|gt|ge|lt|le|match (eq)"] 
> [conj="And|Or (And)"] [group="<Integer Number>"]>{}</Where>]
>
> [<Where name="Fos" [op="eq|ne|gt|ge|lt|le (eq)"] [conj="And|Or (And)"] 
> [group="<Integer Number>"]>{Integer Number}</Where>]
>
> [<Where name="Description" [op="eq|ne|gt|ge|lt|le|match (eq)"] 
> [conj="And|Or (And)"] [group="<Integer Number>"]>{Description}</Where>]
>
> [<Option name="ShowHidden">True|False (False)</Option>]
>
> [<Option name="ShowUsage">True|False (False)</Option>] </Request>
>
> *From:* gold-users-bounces at supercluster.org 
> [mailto:gold-users-bounces at supercluster.org] *On Behalf Of *Mike McCarty
> *Sent:* Monday, February 01, 2010 2:24 PM
> *To:* gold-users at supercluster.org
> *Subject:* [gold-users] Error in gchproject after adding an object 
> attribute
>
> Hi,
>
> I used the follow commands to add an attribute to our Project object.
>
> goldsh Attribute Create Object=Project Name=DisplayProject 
> DataType=Boolean DefaultValue=False
>
> Afterwards the project table looked like the following.
>
> gold=> \d g_project
> Table "public.g_project"
> Column | Type | Modifiers
> ---------------------+-------------------------+------------------------------------
> g_creation_time | integer | not null
> g_modification_time | integer | not null
> g_deleted | character varying(5) | default 'False'::character varying
> g_request_id | integer | not null
> g_transaction_id | integer | not null
> g_name | character varying(1024) |
> g_active | character varying(5) | default 'True'::character varying
> g_organization | character varying(1024) |
> g_special | character varying(5) | default 'False'::character varying
> g_description | character varying(1024) |
> g_grant_number | character varying(1024) |
> g_amie_transaction | integer | default 0
> g_amie_active | character varying(5) | default 'False'::character varying
> g_nccs_project_id | character varying(1024) |
> g_sent_to_nccs | character varying(5) | default 'False'::character varying
> g_pi | character varying(1024) |
> g_prj_type | character varying(1024) |
> g_fos | integer |
> g_display_project | character varying(5) | default 'False'::character 
> varying
> Indexes:
> "g_project_deleted_idx" btree (g_deleted)
> "g_project_name_idx" btree (g_name)
> "g_project_txnid_idx" btree (g_transaction_id)
>
> Then in the psql...
>
> Set g_display_project to the default for the existing records.
> update g_project set g_display_project = 'False';
>
OK, so here, I assume you were trying to set DisplayProject to False for 
all existing projects. The same thing could have been accomplished via:

goldsh Project Modify DisplayProject=False

>
> Set g_display_project to ‘True’ using the filter I had in my forms 
> project select query.
> update g_project set g_display_project = 'True' where <filtered for 
> specific projects>
>
And here, you were trying to set some back to true -- you also could 
have used goldsh.

> My problem is that I now get this in gchproject.
>
> bash-3.2$ gchproject -p TG-STA100003 -X AmieActive=True
> DBD::Pg::db do failed: ERROR: column "g_fos" is of type integer but 
> expression is of type character varying
> HINT: You will need to rewrite or cast the expression.
>
It's hard to say what is happening. If restarting Gold does not resolve 
your problem. I will need to see the goldd.log after reproducing the error.
>
> Notice this was the last column before I added g_display_project. 
> Without looking at the source code, I would guess that there’s an 
> update SQL statement in the database abstraction layer that’s trying 
> to set a char to g_fos instead of g_display_project. Is there another 
> data structure that I need to update after adding the attribute? Or 
> what using psql directly a bad idea?
>
Well, often it is a bad idea. Gold does alot of housekeeping, especially 
in its journal and transaction logs that can get out of sync if you do 
direct manipulations. Of course, SQL queries should be fine. Usually 
there will be a way to accomplish what you want through the goldsh 
interface. On very rare occasions, though, I have gone directly to the 
database if I wanted to circumvent some "safety" business logic. I don't 
see anything real bad with what you have done. The journal would be out 
of sync now, so you would not be able to unwind the transaction, but I 
don't think that is too bad. I assume the time travel used in the bank 
statement will still work because this deals with different tables. Just 
be aware that it is always tentative. I always make a database backup 
before making direct updates to the database so I can recover if I mess 
things up.

Scott

> Thanks,
> -mike
>
> Mike McCarty, HPC Software Developer
>
> National Institute for Computational Sciences (NICS)
> University of Tennessee
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gold-users mailing list
> gold-users at supercluster.org
> http://www.supercluster.org/mailman/listinfo/gold-users
>   



More information about the gold-users mailing list