Forum OpenACS Development: Content Item New

Request notifications

Collapse
Posted by Iuri Sampaio on
Hi there,

I tried to reuse content item new, but it seems the plsql function has been deprecated. It returns an error regarding the column new_nls_language.

The call is bellow:
select content_item__new(:name,-100,:item_id,null,now(),:creation_user,:context_id,:creation_ip,'content_item','ee_product',:title,null,null,null,:package_id)

###
Error logs:
###

Database operation "0or1row" failed (exception ERROR, "ERROR: column "new_nls_language" does not exist
LINE 6: new_nls_language,
^
QUERY: SELECT content_revision__new(
v_title,
new__description,
now(), -- publish_date
new__mime_type,
new_nls_language,
null, -- data/text
v_item_id,
null, -- revision_id
new__creation_date,
new__creation_user,
new__creation_ip,
null, -- content_length
new__package_id
)
CONTEXT: PL/pgSQL function content_item__new(character varying,integer,integer,character varying,timestamp with time zone,integer,integer,character varying,character varying,character varying,character varying,character varying,character varying,character varying,integer,integer,boolean) line 148 at assignment
")

ERROR: column "new_nls_language" does not exist
LINE 6: new_nls_language,
^
QUERY: SELECT content_revision__new(
v_title,
new__description,
now(), -- publish_date
new__mime_type,
new_nls_language,
null, -- data/text
v_item_id,
null, -- revision_id
new__creation_date,
new__creation_user,
new__creation_ip,
null, -- content_length
new__package_id
)
CONTEXT: PL/pgSQL function content_item__new(character varying,integer,integer,character varying,timestamp with time zone,integer,integer,character varying,character varying,character varying,character varying,character varying,character varying,character varying,integer,integer,boolean) line 148 at assignment

SQL:
select content_item__new('giramundo-cuisine',-100,'13060',null,now(),NULL,NULL,NULL,'content_item','ee_product','Giramundo Cuisine',null,null,null,NULL)

while executing
"ns_pg_bind 0or1row nsdb0 {
select content_item__new(:name,-100,:item_id,null,now(),:creation_user,:context_id,:creation_ip,'content_item','ee_pro..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
invoked from within

Collapse
2: Re: Content Item New (response to 1)
Posted by Iuri Sampaio on
Indeed!

I've just noticed the note within the plsql declaration

raise NOTICE 'content_item__new/17 is deprecated, call content_item__new/21 instead';

Best wishes,

Collapse
3: Re: Content Item New (response to 1)
Posted by Gustaf Neumann on
Iuri,

there are several versions of content_item__new() around, which were introduced for backward compatibility. Some of these variants were deprecated more than 10 years ago.

If i count correctly, your code is calling content_item__new with 15 arguments. This is a non-deprecated variant. The problem you found is a typo in a variable, which sneaked in in early 2016 - in a code path, that is not often executed, otherwise it would have been detected earlier. I have fixed this bug in CVS in the HEAD branch and in oacs-5-9, such that people do not forced to the HEAD branch, when they are affected by this issue.

In general, calls to deprecated functions should work, but these should be replaced by non-deprecated variants.

all the best
-gn

Collapse
4: Re: Content Item New (response to 3)
Posted by Iuri Sampaio on
Thanks Gustaf,
I'm glad my debugging has contributed for a bug fix.