All Products
Search
Document Center

PolarDB:ST_SetAccessKey

Last Updated:Mar 28, 2026

Sets the AccessKey pair on a trajectory object for accessing the Object Storage Service (OSS) bucket that stores its data.

Important

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

Syntax

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

Parameters

ParameterDescription
trajThe trajectory object.
akidThe AccessKey ID for accessing the OSS bucket.
aksecretThe AccessKey secret for accessing the OSS bucket.
checkvalidSpecifies whether to validate the AccessKey pair against the OSS bucket. Default value: true. When set to true, the function tests bucket access using the provided credentials. If the test fails, an error is returned.

Description

When reading trajectory data from a file in an OSS bucket, the trajectory object must carry a valid AccessKey pair to authenticate against the bucket. An AccessKey pair consists of an AccessKey ID (analogous to a username) and an AccessKey secret (analogous to a password).

ST_SetAccessKey resets the AccessKey pair associated with a trajectory object and returns the updated trajectory.

Example

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

Replace <OSS_USER> with the AccessKey ID and <OSS_PWD> with the AccessKey secret.

The query returns the updated trajectory objects:

                                                            st_setaccesskey
----------------------------------------------------------------------------------------------------------------------------------------
 {"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)