All Products
Search
Document Center

PolarDB:ST_SetStorageLocation

Last Updated:Mar 18, 2025

You can use this function to change the location of the Object Storage Service (OSS) file that stores the data 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

traj

The trajectory object.

new_path

The string that specifies the folder in which you want to store the data of the specified trajectory object. Only folders in OSS are supported. The format of the parameter value is 'OSS://<AccessKey ID>:< AccessKey secret>@<Endpoint>/<Bucket>/<Directory>'. The data of the specified trajectory object is stored in a .gtf file in the specified folder.

checkvalid

Specifies whether to check the validity of the path. Default value: true. If this parameter is set to true, the system tests whether the specified OSS directory can be accessed by using your AccessKey pair. If the access test fails, an error is returned.

Description

This function changes the location of the file that stores the data of a specified trajectory object. This function does not move the original file that stores the data of the trajectory object. Before you use this function to specify a new location, you first need to move the folder that contains the trajectory data file in OSS to the new location.

After the file is moved to the new location, new trajectory data may not be appended to the file. In this case, an error message that contains is not appendable is returned. Make sure that the last data block is uploaded by calling the AppendObject operation of OSS.

Examples

SELECT ST_SetStorageLocation(traj, '<New Path>') FROM trajs;
                                                                                                                                                                                                                                         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)