All Products
Search
Document Center

PolarDB:ST_SetAkId

Last Updated:Mar 28, 2026

Sets the AccessKey ID on a trajectory object to authenticate access to the Object Storage Service (OSS) bucket that stores the trajectory data.

This function is not supported in later versions. Use Cold data tiered storage instead.

Syntax

trajectory ST_SetAkId(trajectory traj, text akid, bool checkvalid default true);

Parameters

ParameterDescription
trajThe trajectory object.
akidThe AccessKey ID used to access the OSS bucket.
checkvalidSpecifies whether to validate the AccessKey ID against the OSS bucket. Default value: true. If set to true, the system tests whether the AccessKey ID can access the bucket and returns an error if the test fails.

Description

When reading trajectory data stored in an OSS bucket, you must provide an AccessKey pair to authenticate. An AccessKey pair consists of an AccessKey ID and an AccessKey secret — the AccessKey ID identifies the requester (similar to a username) and the AccessKey secret authenticates the request (similar to a password).

ST_SetAkId resets the AccessKey ID associated with a specified trajectory object. The updated AccessKey ID is used for subsequent reads of the trajectory data from OSS.

Examples

SELECT ST_SetAKId(traj, '<OSS_USER>') FROM trajs;

Output:

                                                                                                                                                                                                                                                   st_setakid
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2 0,33.042158099636 36.832684322819 0,47.244002354518 47.230026333034 0,64.978971942887 60.618813472986 0,77.621717839502 78.012496630661 0,80 78 0)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2 0,33.042158099636 36.832684322819 0,47.244002354518 47.230026333034 0,64.978971942887 60.618813472986 0,77.621717839502 78.012496630661 0,80 78 0)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2,33.042158099636 36.832684322819,47.244002354518 47.230026333034,64.978971942887 60.618813472986,77.621717839502 78.012496630661,80 78)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 TRAJECTORY EMPTY
(4 rows)