All Products
Search
Document Center

PolarDB:ST_SetStorageLocation

Last Updated:Mar 28, 2026

Updates the Object Storage Service (OSS) storage path of a trajectory object.

Note

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

Syntax

trajectory ST_SetStorageLocation(trajectory traj, text new_path, bool checkValid default true);

Parameters

Parameter

Description

trajThe trajectory object.
new_pathThe OSS folder path where the trajectory data is stored. Only OSS folders are supported. Format: 'OSS://<AccessKey ID>:< AccessKey secret>@<Endpoint>/<Bucket>/<Directory>'. The trajectory data is stored as a .gtf file in the specified folder.
checkValidSpecifies whether to validate the path. Default value: true. If set to true, the function tests whether the specified OSS directory is accessible using your AccessKey pair. An error is returned if the access test fails.

Usage notes

This function updates the recorded storage path of a trajectory object. It does not move the original file that stores the data of the trajectory object. Before calling this function, manually move the trajectory data file in OSS to the new location.

After moving the file, new trajectory data may not be appendable. If you receive an error containing is not appendable, ensure the last data block was uploaded using the AppendObject operation of OSS.

Example

SELECT ST_SetStorageLocation(traj, '<New Path>') FROM trajs;

Output:

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